This error (CS0009 with a monocompiler) is quite common and means "something is wrong" with this assembly, therefore it is rather difficult to debug. One way to continue is to really compile under mono. If you download the source code ( https://github.com/pythonnet ), you will find instructions on how to do this (look at pythonnet \ src \ monoclr \ README. Txt as well).
However, depending on your goals, you can instead use IronPython, which is officially supported mono and exhausted. The example below assumes that you downloaded the zip from IronPython and extracted it somewhere:
scriptcs -modules mono scriptcs (ctrl-c to exit or :help for help) > #r "G:\dev_tools\IronPython-2.7.5\IronPython-2.7.5\IronPython.dll" > #r "G:\dev_tools\IronPython-2.7.5\IronPython-2.7.5\Microsoft.Dynamic.dll" > #r "G:\dev_tools\IronPython-2.7.5\IronPython-2.7.5\Microsoft.Scripting.dll" > using System; > using System.IO; > using IronPython.Hosting; > using Microsoft.Scripting; > using Microsoft.Scripting; > using Microsoft.Scripting.Hosting; > string script = "print 'hello world'"; > var engine = Python.CreateEngine(); > var scope = engine.CreateScope(); > var source = engine.CreateScriptSourceFromString(script, SourceCodeKind.Statements); > var compiled = source.Compile(); > var result = compiled.Execute(scope); hello world >
source share