It seems that tulip overrides the std module because :
For example, the following script:
from tulip import *
from tulipgui import *
from tulipogl import *
import sys
sys.stdout.write("Stdout test\n")
sys.stderr.write("Stderr test\n")
sys.exit(3)
produces the following result:
[PythonStdOut] "Stdout test"
[PythonStdErr] "Stderr test"
[PythonStdErr] "Traceback (most recent call last):"
[PythonStdErr] " File "scripts/test.py", line 14, in <module>"
[PythonStdErr] " sys.exit(-1)"
[PythonStdErr] "AttributeError: 'module' object has no attribute 'exit'"</module>
with an exit code of 1
instead of
Stdout test
Stderr test
with an exit code of 3
Hi,
I can not reproduce your issue with Tulip 4.8
If I launch your script through the classical Python interpreter, I got the correct output and no errors.
Nevertheless, the embedded interpreter in the Tulip software overrides the standard output in order to redirect it to the console and log widgets. The 'exit' function is also removed as it could crash Tulip. That environment customization is only applied when no interpreter instance already exists (this is not the case when launching a script trough the
python command).
Antoine
Hi
I guess my description was not enought precise ;) Of course the issue accurs when I launch the script through the python command.
However, I was not using the very last version of the trunk. After an update to revision 11173, I noticed the issue was solved.
Sorry for the noise ; a bug fix should have been committed in december
At this time, this bug seems to be fixed in the current svn code line,
since a recent (but undated) commit .