Re: [Python.NET] How to run a command by Embedded Python?

2013-03-28 Thread [email protected]
Doesn't it just depend on where you want the async to be? On the python side or on the .net side? You could do it all in the python side and just stick to python async methodologies. Or you could do it in .net in which case you need to use the multi-threaded aspects of pythonnet. -brad On M

Re: [Python.NET] how to load and execute py file which consumes a thrid part C-based python extension in C# code

2013-03-28 Thread [email protected]
Sorry. One more. When my code then executes those callbacks, back into Python, it does so this way: System.Console.WriteLine("Getting Projects"); List ret = new List(); //the things I expect python to give me back System.Console.WriteLine("Getting lock");

Re: [Python.NET] How to run a command by Embedded Python?

2013-03-28 Thread Seungweon Park
BTW, PyObject po = PythonEngine.RunString(strCommand); returns 'null' when running "os.getcwd()", and PythonEngine.RunSimpleString(strCommand) returns '-1'. Currently, I'm working on Async ways to execute a python command (some commands take long to finish a task such as switch configuration, once

Re: [Python.NET] how to load and execute py file which consumes a thrid part C-based python extension in C# code

2013-03-28 Thread [email protected]
In my code I'm running: Python.Runtime.PythonEngine.Initialize(); I also have these defined: public void AddPythonPath(string path) { CheckInitPython(); IntPtr l = Python.Runtime.PythonEngine.AcquireLock(); Python.Runtime.Python

[Python.NET] How to run a command by Embedded Python?

2013-03-28 Thread Seungweon Park
Hi, I wrote a code PythonWrapper and SimplePythonTest which uses PythonWrapper. using SimplePython; namespace SimplePythonTest { /// /// Python Wrapper Tests /// [TestFixture] public class PythonTests { PythonWrapper py; /// /// PythonTests Con

Re: [Python.NET] how to load and execute py file which consumes a thrid part C-based python extension in C# code

2013-03-28 Thread lizy10b
Thank you, Bradley. I found a simple sample code on the maillist. Now I could load and execute a pure python function in a py file in C#. And a new problem is that the PythonEngine.ImportModule("modulename") method always return NULL in my case. The modulename.py comsumes a third part ctypes w

Re: [Python.NET] how to load and execute py file which consumes a thrid part C-based python extension in C# code

2013-03-28 Thread Bradley Friedman
What you are looking to do is "embed" a python interpreter in your .net project, using pythonnet, and then tell the runtime to execute your python script. I have done this in one of my projects. It does work. http://pythonnet.sourceforge.net/readme.html#embedding Sent from my iPad On Mar 28

[Python.NET] how to load and execute py file which consumes a thrid part C-based python extension in C# code

2013-03-28 Thread lizy10b
Hi there, I am a freshman and new to python.net. I have a *.py script which calls a third part python library, and the library is a ctypes python wrapper of a C++ dll (or say C-based python extension?). Frist I tried to make it using IronPython. IronPython works well when I load a pure python