Forum

Author Topic: No debug info when running a script from menu + Best IDE to write a script ?  (Read 4292 times)

jochemla

  • Newbie
  • *
  • Posts: 10
    • View Profile
Hi everyone,

I am writing som ePython scripts to automate some processes. I made these scripts available through new menu entries. The problem is that it is hard to debug with this kind of scripts - the script simply exits when there is an error, without saying at which line the error is.

If I run the scripts using the Tools/Run Script entry, then I can find where the error lies, but this is not the most convenient debug workflow. So my question is :

Do you have an idea on how to debug these scripts run from a menu entry ? What are you using to write your Python scripts (I am using Notepad++, but there is no Python auto-completion like there is in the Photoscan command line (using Ctrl+Space) for example. I cannot use PyCharm for example since I have no access to PhotoScan.py library (which is normal, but annoying when writing large scripts).

Thanks a lot for your help ! :)

Jonathan

Gall

  • Jr. Member
  • **
  • Posts: 85
    • View Profile
Hello Jonathan,

for debug purpose, I use something like this and it worked well so far.
Code: [Select]
import traceback

def launch_xxx():
try:
execute_workflow()
except:
# Display stack on error
traceback.print_exc()

For the IDE I use mainly geany wich has, like notepad++ I guess, auto-completion on user code (with opened tabs only) and standard library (I guess it depends on wich config files are available for it). Nothing too fancy though...

I hope the snippet will help you.

albu

  • Newbie
  • *
  • Posts: 1
    • View Profile
    • geoscan.aero
Sorry for necroposting but I'm sure I've found best solution.

You can use PTVS (Python Tools for Visual Studio) with it's remote debugging capabilities.
Both are free for use and it works perfect for me.

You need separate python33 and pip.
Code: [Select]
pip install ptvsdcopy ptvsd folder from your site-packages to PhotoScan site-packages folder. (btw you can do it for anything you want)

after it follow instructions in
https://github.com/Microsoft/PTVS/wiki/Cross-Platform-Remote-Debugging