|
The easiest way to compile something is to run it w/
-X:SaveAssembiles: Ipy.exe –X:SaveAssemblies toto.py Will write out a toto.exe. Then you can just do an AppDomain.CurrentDomain.ExecuteAssembly
on that and it’ll run. Note you won’t be able to get at the classes defined in
the assembly from the .NET code. If you just want to compile & run inside of your process you’re
probably better off using the PythonEngine APIs which provide compile &
execute functionality, but this won’t allow you to save it to disk. From:
[EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Prince0 Hi, I
have compiled my Python script and now I would like to use it as a standard DLL
assembly. How
can I do this? Here’s
my current code: List<string> files = new
List<string>(); files.Add(@"c:\toto.py"); PythonCompiler compiler = new PythonCompiler(files,
@"c:\toto.dll"); compiler.Compile(); Then: private toto toto1; ctor() this.toto1 = new toto();
PythonModule pm = Ops.InitializeModule(this.toto1,
"toto", new
string[0]);
pm.SystemState.stdout = new PythonFile(File.Create(@"c:\output.txt"), Encoding.ASCII, "output",
"w"); OnClick() Ops.ExecuteCompiled(new InitializeModule(this.toto1.Initialize)); Is
there a better way? It seems I will have to modify IronPython’s source code so
I can also specify the args. |
_______________________________________________ users mailing list [email protected] http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
