Seungweon Park
2013-04-04 20:40:05 UTC
Image file is not attached. Here it goes.
Hi,
Actually, my questions are
1. How to turn on console window(live) from Windows System
while debugging Embedded PythonNet app?
2. How to capture python script execution output from C# code?
output result of any python command using PythonEngine.RunString() or
PythonEngine.RunSimpleString().
I've been tried to debug simple code with Python.Runtime project, but
can't find how to turn on this console window, nor capture the python
script execution output.
What I'm trying to do is that I don't want to modify any python script
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Python.Runtime;
using System.Diagnostics;
namespace npythontest
{
public class Program
{
static void Main(string[] args)
{
PyObject po;
PythonEngine.Initialize();
IntPtr pythonLock = PythonEngine.AcquireLock();
po = PythonEngine.RunString("execfile('c:\\cvs\\brocade.py')");
PythonEngine.ReleaseLock(pythonLock);
PythonEngine.Shutdown();
}
}
}
and a.py prints out many string output. I want to capture this output by
RunString()/RunSimpleString() method, but it doesn't return any result
except 'null'. It seems it isn't for getting output.
Then, while talking to Brad, his screenshot from his Mac OS with Mono
displays the execution result output on an window like below, so wonder if
windows environment can have same console window.
Previously, Oleksii and Sharon mentioned in the thread
http://mail.python.org/pipermail/pythondotnet/2011-March/001103.html, but
don't know it's already implemented or not. However, I can't find how to
have same environment from my window system like Brad's Mac has.
So would you help me how to capture the python script output or have
console window for debugging when I'm using embedded PythonNet?
Thank you,
Spark.
Actually, my questions are
1. How to turn on console window(live) from Windows System
while debugging Embedded PythonNet app?
2. How to capture python script execution output from C# code?
output result of any python command using PythonEngine.RunString() or
PythonEngine.RunSimpleString().
I've been tried to debug simple code with Python.Runtime project, but
can't find how to turn on this console window, nor capture the python
script execution output.
What I'm trying to do is that I don't want to modify any python script
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Python.Runtime;
using System.Diagnostics;
namespace npythontest
{
public class Program
{
static void Main(string[] args)
{
PyObject po;
PythonEngine.Initialize();
IntPtr pythonLock = PythonEngine.AcquireLock();
po = PythonEngine.RunString("execfile('c:\\cvs\\brocade.py')");
PythonEngine.ReleaseLock(pythonLock);
PythonEngine.Shutdown();
}
}
}
and a.py prints out many string output. I want to capture this output by
RunString()/RunSimpleString() method, but it doesn't return any result
except 'null'. It seems it isn't for getting output.
Then, while talking to Brad, his screenshot from his Mac OS with Mono
displays the execution result output on an window like below, so wonder if
windows environment can have same console window.
Previously, Oleksii and Sharon mentioned in the thread
http://mail.python.org/pipermail/pythondotnet/2011-March/001103.html, but
don't know it's already implemented or not. However, I can't find how to
have same environment from my window system like Brad's Mac has.
So would you help me how to capture the python script output or have
console window for debugging when I'm using embedded PythonNet?
Thank you,
Spark.