One of my other devs brought me a odd issue. After upgrading to 8.1.10 print statements when using script console for debugging stopped working. This only happens in specific situations where a custom class is used in the script, it almost seems as though the print() is being overridden somehow. However this issue did not occur in 8.1.6, so I assume this is related to the update to jython 2.7.2
I cannot find any obvious issues, any jython experts know of changes in 2.7.2 that could cause this?
Print statements or print calls as a function? The latter would require from __future__ import print_function as the first line in whatever execution environment youāre in, on any Python 2.X version.
Iād send you the code, but way to many dependencies on our specific environment in this code, so just trying to find some help looking for a direction to investigate.
Could the code be calling System.exit() or otherwise exiting ātoo fastā? I donāt think you can non-trivially break the print statement (outside of the aforementioned magic import to turn it into a function).
If you can annotate the code youāre calling with more prints, that may help identify where in the code itās āstoppingā.
I can replicate this issue. In the attached screenshot I ran the script console twice. The first time nothing got printed after the class method was run and the second time all the prints came through fine. Every time I open a new designer this issue happens on the first execution. I am on version 8.1.10
Iāve been out for a week, but letās get into it
Thereās pretty much no chance this is going to be fixed in 8.1.12; itās too late in the game.
You posted a minimal example a few days ago, but that seems like a different issue than the main topic of this thread. Itās potentially a bug worth fixing (Iāll take a look at it) but without an SSCCE for the main issue I donāt have a lot to go forward with.
Iāve also discovered this issue but I didnāt find a correlation between custom classes and the issue. 8.1.10
We used some logger functions though out the function weāre calling and the logs do post, but not the print statements or the return of the function.
It seems like the console output is just being dropped or truncated some how.
A second execute in the script console shows the expected output on the interpreter.
Hi PGriffith, I'm running in the same problem: the print() function (with use of _ _ future _ _ module) appears as no flushing the output stream (wrapper.log, print () used inside a timer script). If I remove the module _ _ future _ _ import and using print without (), it works. Quite strangely, if a second script is flushing on the wrapper, all is ok also with print(). The same script, in the Designer script console, properly works always. I wish to maintain the _ _ future _ _ module. Is there anything I can do? Many thanks.
Hi, many thanks for the information. It would be great to have a stand-alone "patch" for existing version, not feasible to update production environment for that.
That's not really how things work. Jython is tightly integrated throughout Ignition, so when we bump the version we have to regression test all of Ignition, which we also do with every product version.
If you, personally, want to take the significantly more risky step of dropping in a new version of Jython to fix this minor issue, you can do so - just download the Jython release jar from Github into the gateway, in the lib/core/common folder, overwriting the existing Jython JAR. But be aware it's totally unsupported.