Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen angezeigt.

Link zu dieser Vergleichsansicht

Nächste Überarbeitung
Vorhergehende Überarbeitung
en:debugging_of_scripts [2019/06/16 13:04]
hlinke angelegt
en:debugging_of_scripts [2019/06/30 18:17]
hlinke [Python Scripting for VEGAS Pro]
Zeile 1: Zeile 1:
-====== Python Scripting for VEGAS Pro ======+====== Python Debugging ======
  
 VEGASPython is embedded in VEGAS. This can create issues for some Python debuggers. VEGASPython is embedded in VEGAS. This can create issues for some Python debuggers.
Zeile 94: Zeile 94:
  
 "debugusereload": true "debugusereload": true
- 
- 
- 
- 
-"debugusereload": true 
- 
- 
- 
- 
-====== Python Scripting for VEGAS Pro ====== 
- 
-VEGASPython is embedded in VEGAS. This can create issues for some Python debuggers. 
-I am using the WING Python IDE [[https://wingware.com/]]. 
-There is a free version (WING IDE Personal) for non-comercial use and a professional version available.  
-Other debuggers may work as well, but I have not tested them. 
-If you have experience with another debugger, please inform me and I will add this information to this chapter. 
- 
-===== Debugging using WING Python IDE ===== 
- 
-For debugging VEGASPython scripts with WING IDE please follow following steps: 
- 
-  - copy the file wingdbstub.py from the wing IDE program directory to the VEGASPython_PN directory, where your VEGASPython code is located. 
-  - open wingdbstub.py and change the line: "kEmbedded = 0" to "kEmbedded = 1" 
-  - add the following line at the begin of the python code: "import wingdbstub" 
-  - Turn on listening for externally initiated debug connections in Wing, which is most easily done by clicking on the bug icon in the lower left of the main window and selecting "Accept Debug Connections" in the popup menu that appears. 
- 
-Load the Python Script into Wing IDE and set breakpoints. 
- 
-Start the script from VEGAS extension menu. (It is not possible to debug interactive scripts from the interactive window) 
- 
-When you do changes to the script VEGAS needs to be restarted to load the updated script. 
- 
-===== The VEGASPYTHON Config File ===== 
-In the main directory where you extarcted the ZIP file you will find the file VEGASPython_CONFIG.JSON. 
-This file provides important config parameters to support the debugging: 
- 
-This is the content of the file: 
- 
-{ 
-     
-    { 
-    "PythonPath": "", 
-    "debugmode": false, 
-    "debugprecmd": "import wingdbstub;print ('Wing Debug started')", 
-    "debugpostcmd": "print ('Debug ended')", 
-    "debugusereload": true 
-    } 
-} 
- 
-If you are familiar with JSON files you will know that the structure has to be maintained. Otherwise the parameters will not be recognized any more. Change value only between the "" or change true to false or viceversa. 
- 
-==== Description of the Config parameters ==== 
-=== PythonPath === 
-as default Python is installed in the subdirectory \Python37 of the VEGASPython installation directory. 
-This is good for users who do not want to deal with Python. 
-If you have your own Python Installation(it must be Python 3.7.x) the you can here specify the directory where it resides. 
- 
-Example: 
-"PythonPath": "C:\\Python37" 
- 
-If the parameter is empty  
- 
-Do not forget to double "\" in the Path. 
- 
-=== debugmode=== 
-debugmode is the main switch for the debugging parameters. 
- 
-"debugmode": false 
- 
-The debug parameters are ignored 
- 
-"debugmode": true 
- 
-The debug parameters are used. 
- 
-=== debugprecmd === 
-Defines Python commands that need to be executed before the start of the Python script. 
-Here you can add commands that are needed by the debugger to start the debugging and connect with the embedded Python interpreter. 
- 
-Example: 
- 
-"debugprecmd": "import wingdbstub;print ('Wing Debug started')" 
- 
-Imports the wingdbstub.py that is needed by WING Python IDE to start the debugging. You can remove this when you do not use WING Python IDE. 
- 
-=== debugpostcmd === 
-Defines Python commands that need to be executed after the end of the Python script. 
-Here you can add commands that are needed by the debugger to stop the debugging. 
- 
-Example: 
- 
-"debugpostcmd": "print ('Debug ended')" 
- 
-=== debugusereload === 
-As explained above you need to restart VEGAS after any change in the Python script. 
- 
-To avoid this restart and reduce the turn arround times VEGASPython can use the "reload" command to load a script. 
- 
-Reloading a module is not a clean concept and can create some issue. Please read the chapter reload() in the Python documentation before using this fundtion: 
-[[https://docs.python.org/3/library/imp.html?highlight=reload#imp.reload]] 
- 
-example: 
- 
-"debugusereload": true 
- 
- 
- 
- 
- 
- 
- 
- 
- 
- 
- 
- 
- 
- 
- 
- 
- 
- 
- 
- 
- 
- 
- 
- 
- 
- 
- 
- 
  

Andere Sprachen
QR-Code
QR-Code en:debugging_of_scripts (erstellt für aktuelle Seite)