Has anyone had any luck with mono / pythonnet ? #691
-
I'm trying to get pythonnet to load YoutubeExplode via mono on Ubuntu Linux. After #!/usr/bin/env python3
# See https://pythonnet.github.io/pythonnet/python.html
# See https://github.com/Tyrrrz/YoutubeExplode
import os
import pythonnet
pythonnet.load("mono")
import clr
import System
for s in [
"AngleSharp",
"Microsoft.Bcl.AsyncInterfaces",
"System.Buffers",
"System.Memory",
"System.Numerics.Vectors",
"System.Runtime.CompilerServices.Unsafe",
"System.Text.Encoding.CodePages",
"System.Text.Encodings.Web",
"System.Text.Json",
"System.Threading.Tasks.Extensions",
"System.ValueTuple",
"System.ValueTuple",
"YoutubeExplode",
]:
clr.AddReference(s)
import YoutubeExplode
youtube = YoutubeExplode.YoutubeClient()
print(youtube) which results in this error about
It appears this is a system-level Windows dll, so I'm not sure if mono is able to provide an equivalent. Anyway, thought I'd start a thread and see if anyone else has had luck with this, or with running on mono in general. Cheers! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 5 replies
-
I should mention that I have no idea what I'm doing with either mono or C#, so if you see a seemingly obvious error, please point it out! |
Beta Was this translation helpful? Give feedback.
-
The error comes from here: https://github.com/Tyrrrz/FuckRussia/blob/27043a5be63fa54cccc15c0dee2bf4fc54a768b5/FuckRussia/Initializer.cs#L49-L57 It appears mono might be lying what OS it's running on, possible to ensure compatibility with legacy .NET Framework. That said, I don't see why you'd need to use mono at all, you should be able to run your code with .NET directly: https://dotnet.microsoft.com/en-us/download I haven't used Python.NET but I assume you should replace your import pythonnet
-pythonnet.load("mono")
+pythonnet.load("coreclr") Make sure you have the latest .NET SDK installed. |
Beta Was this translation helpful? Give feedback.
The error comes from here: https://github.com/Tyrrrz/FuckRussia/blob/27043a5be63fa54cccc15c0dee2bf4fc54a768b5/FuckRussia/Initializer.cs#L49-L57
It appears mono might be lying what OS it's running on, possible to ensure compatibility with legacy .NET Framework.
That said, I don't see why you'd need to use mono at all, you should be able to run your code with .NET directly: https://dotnet.microsoft.com/en-us/download
I haven't used Python.NET but I assume you should replace your
load(...)
call with the following:Make sure you have the latest .NET SDK installed.