Hello, I'm adding a python console into my application using the PythonQt Scripting Console. I have set the flag in the init() method of PythonQt to redirect stdout and stderr to the console and everything works well.
However, on occasion, when I run some code, the pythonStdOut and pythonStdErr signals stop firing, so I get no output in the console. I do however still get printouts in the terminal that I launch the application from. Can anyone think what might be happening to stop these signals firing? The only thing I could think was that the pointer returned by self() somehow breaks and has to reload, therefore destroying the connection, but I'm not doing anything that would cause that... (I don't think)...
Any help would be greatly appreciated.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I just ran a test to see if self() returned a different pointer, and it doesn't, so my signal/slot connection getting disconnected because the PythonQt instance breaks doesn't make sense.
Cheers
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I have found the problem here, it was to do with separate python interpreters in my code. By instantiating a new interpreter using the standard python modules, the PythonQt overidden stdout and stderr objects were getting swapped out for the generic stdout and stderr modules. So, the signal stopped firing. I have got around this by storing that object and reinjecting it whenever the interpreter is swapped out.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello, I'm adding a python console into my application using the PythonQt Scripting Console. I have set the flag in the init() method of PythonQt to redirect stdout and stderr to the console and everything works well.
However, on occasion, when I run some code, the pythonStdOut and pythonStdErr signals stop firing, so I get no output in the console. I do however still get printouts in the terminal that I launch the application from. Can anyone think what might be happening to stop these signals firing? The only thing I could think was that the pointer returned by self() somehow breaks and has to reload, therefore destroying the connection, but I'm not doing anything that would cause that... (I don't think)...
Any help would be greatly appreciated.
I just ran a test to see if self() returned a different pointer, and it doesn't, so my signal/slot connection getting disconnected because the PythonQt instance breaks doesn't make sense.
Cheers
I have found the problem here, it was to do with separate python interpreters in my code. By instantiating a new interpreter using the standard python modules, the PythonQt overidden stdout and stderr objects were getting swapped out for the generic stdout and stderr modules. So, the signal stopped firing. I have got around this by storing that object and reinjecting it whenever the interpreter is swapped out.