C
Chris8Boyd
I am embedding Python in a MSVC++ (2005) application. The application
creates some environment and then launches a Python script that will
call some functions exported from the MSVC++ application.
I want to be able to debug the Python script by using a debug server,
like Winpdb (winpdb.org).
I use ActivePython 2.5.2.2, Microsoft Visual Studio 2005, and Winpdb
1.3.8.
When I launch a script like "e:>python test.py" everything is O'K and
I can use Winpdb to trace/debug.
When I run the same script from the MSVC++ application, there is
always a complain "ImportError: No module named _socket".
Here is the basic test script I use:
def Process( something ):
print "\n\nStarted debugging\n=================\n"
#pydevd.settrace()
import rpdb2; rpdb2.start_embedded_debugger("1")
print "\n\nStopped debugging\n=================\n"
if __name__ == '__main__':
Process( "test" )
<<<
In the MSVC++ application I tried many approaches, as suggested by
many people, and all of them work to launch the script, but none of
them works with Winpdb (or PyDev for Eclipse - same problem). Just for
completeness - here is one:
PyRun_SimpleString("import sys");
PyRun_SimpleString("import os");
PyRun_SimpleString( "fullpath = os.path.abspath(\"E:/Test.py\")" );
PyRun_SimpleString( "g = globals().copy()" );
PyRun_SimpleString( "g['__file__'] = fullpath");
PyRun_SimpleString( "execfile(fullpath, g) ");
<<<
If I use pdb (import pdb + pdb.runcall(something) ) everything works
fine, but I need the performance and convinience of Winpdb.
What am I doing wrong?
Your help is highly appreciated!
Best regards,
Chris
creates some environment and then launches a Python script that will
call some functions exported from the MSVC++ application.
I want to be able to debug the Python script by using a debug server,
like Winpdb (winpdb.org).
I use ActivePython 2.5.2.2, Microsoft Visual Studio 2005, and Winpdb
1.3.8.
When I launch a script like "e:>python test.py" everything is O'K and
I can use Winpdb to trace/debug.
When I run the same script from the MSVC++ application, there is
always a complain "ImportError: No module named _socket".
Here is the basic test script I use:
def Process( something ):
print "\n\nStarted debugging\n=================\n"
#pydevd.settrace()
import rpdb2; rpdb2.start_embedded_debugger("1")
print "\n\nStopped debugging\n=================\n"
if __name__ == '__main__':
Process( "test" )
<<<
In the MSVC++ application I tried many approaches, as suggested by
many people, and all of them work to launch the script, but none of
them works with Winpdb (or PyDev for Eclipse - same problem). Just for
completeness - here is one:
PyRun_SimpleString("import sys");
PyRun_SimpleString("import os");
PyRun_SimpleString( "fullpath = os.path.abspath(\"E:/Test.py\")" );
PyRun_SimpleString( "g = globals().copy()" );
PyRun_SimpleString( "g['__file__'] = fullpath");
PyRun_SimpleString( "execfile(fullpath, g) ");
<<<
If I use pdb (import pdb + pdb.runcall(something) ) everything works
fine, but I need the performance and convinience of Winpdb.
What am I doing wrong?
Your help is highly appreciated!
Best regards,
Chris