-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
python printing is broken #2
Comments
So, there is now a partial fix in pull req opencog/atomspace#837 -- but more work in the cogserver shell is needed. |
The original issue is described here: opencog/atomspace#629 and its probably an issue again... |
I'm pretty sure that issue opencog/opencog#1596 is an issue again. Basically, at this time, all python prints are going to the cogserver shell. |
This commit: opencog/atomspace@32e8bf0 trashed the previous python stdout-capture code. This was done because python agents or any python inf loop would hang the cogserver, because that code was waiting forever for the output to arrive, slowly growing over time, per comment opencog/opencog#2301 (comment) The right fix might be to capture stdout in a different python thread, and forward that to the shell prompt. This would require restoring the above commit, and changing it to multi-task and send the print results back in dribbles. Alternately, PERFORM_STDOUT_DUPLICATION could be re-enabled in the GenericShell.cc |
how about redirecting stdout to a pipe and then reading to a variable like _result
|
Hi @Dagiopia the old code did something similar, and it doesn't work, if the print is being issued from an infinite loop. So, for example, some long-running python code is started e.g. a so-called "mind agent" -- which might run for minutes or hours, and it has print statements inside of it. What you propose will either hang or stall, or, if not that, will have the pipe grow to unbounded size. There is some older code that partly/mostly solves this problem, but it got kind-of trashed recently. It solved teh problem by capturing everything that goes to stdout, and stuffs it into a pipe, and then, in a different thread, it empties that pipe out. This can continue indefinitely. The code is here: I don't quite recall what it is that makes it buggy or unstable. It used to work -- it almost works now, but there are some kind of issues. |
yes @linas I was afraid there may be something it will ruin. |
I've stubbed out line 106 in tests/cython/PyEvalUTest until this issues gets fixed. When this is fixed, that line of code should be placed back. |
@linas Are the comments here up to date? I.e. is this still an issue and no one is working on it so therefore an issue that I can grab and handle without stepping on someone else's work? |
Printing to the python shell is broken. This got broken by pull request opencog/opencog#2311, the refactoring of the network code is not yet complete.
Tor reproduce: telnetto the cogserver, enter the python shell, and execute any python code -- nothing is printed.
The text was updated successfully, but these errors were encountered: