To debug Python code it is always possible to print data of variables to a file, with something like this:
Code Block |
---|
f=open('C:/temp/my_debug.txt','a')
f.write('hello world\n')
f.close() |
The scenery of use python in GiD is not usual:
The ‘normal’ case is to run a python.exe process that evaluate the code of a .py python file.
The GiD case run a gid.exe that has embedded a Tcl interpreter and at run time is loaded the tohil package that create an embedded Python interpreter and add Tcl commands to call Python to this interpreter . At run time it is also possible that this Python interpreter import the tohil module that add Python functions to call the Tcl interpreter.
Note: Running python.exe and importing tohil will create a new Tcl interpreter (not related at all with the one embedded in GiD, then GiD commands cannot be used)