2

I am running a project that makes calls to C++ framework functions and python modules, I can run it on Wing IDE with no problems (personal version). However, I can not debug on the run. It only lets me debug a certain file, which is pretty useless. I make a call to a shell script to run the framework function via a python file (init) and that function calls a python module that I want to debug. I have had the same problem with pyCharm. I have spent quite a while trying to figure this out, something that should be very basic. How can I fix this problem and debug on the go???

dusa
  • 840
  • 3
  • 14
  • 31
  • 1
    Do you run your program via a .py file that that imports the C++ framework or are you launching a C++ program that then executes your python code? If it's the latter, you probably need to use Wing's support for debugging externally launched code as described in https://wingware.com/doc/debug/debugging-externally-launched-code – John Ehresman Mar 22 '17 at 20:23
  • I use a pyton file to call shell scripts from within python as below: `[import os import subprocess import pdb env = os.environ.copy() env['HDF5_DISABLE_VERSION_CHECK'] = '1' env['PYTHONPATH'] = '.' env['GLOG_logtostderr'] = '1' subprocess.call(["/home/duygu/Desktop/lisa-caffe-public- lstm_video_deploy/build/tools/caffe","train", "-solver", "lstm_solver.prototxt", "-weights", "pretrained.caffemodel"], env=env)` and that calls a python module at some point. I will check the link, thank you. – dusa Mar 22 '17 at 20:38
  • You're launching a non-Python process so if you're starting debug with the above Wing can't debug-instrument the child process because it's not Python and then when it calls Python we have no way of debugging that. The way to work with this kind of a setup is to use 'import wingdbstub' to import a copy of the wingdbstub.py that is in your Wing installation to initiate debug. See http://wingware.com/doc/debug/debugging-externally-launched-code for details on how to set that up. – Wingware Mar 22 '17 at 20:50
  • @Wingware Thanks a lot for your answer, I am skimming through the link and it is an alien concept for me. Do you know where I can find wingdbdstub.py?? When I try to download source code it asks me my customer name etc. (I am only using pro trial version right now / switched from personal one to see if this version has the feature I was asking about) – dusa Mar 22 '17 at 21:15
  • Nevermind! I found it under debugger packages – dusa Mar 22 '17 at 21:18
  • Got it working with wingdbdstub.py ! Thanks a bunch! – dusa Mar 22 '17 at 21:27
  • @dusa you should write an answer with the complete solution (and mark it as accepted) to not leave the question hanging unanswered – Dan Cornilescu Mar 23 '17 at 01:30
  • @DanCornilescu Thanks, however seems like stack flow doesn't accept my answers anymore. To anyone who is having the same issue, to sum up: Following the comments above, I have copied the wingdbstub.py file (from debugger packages of Wing ide) to the folder I am currently running my project on and used 'import wingdbstub' & initiated the debug process. All went well. – dusa Mar 23 '17 at 03:04
  • It can wait until you get more reputation, no problem. – Dan Cornilescu Mar 23 '17 at 03:06

1 Answers1

1

Following the comments above, I have copied the wingdbstub.py file (from debugger packages of Wing ide) to the folder I am currently running my project on and used 'import wingdbstub' & initiated the debug process. All went well, I can now debug modules.

dusa
  • 840
  • 3
  • 14
  • 31