Skip to content
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 evaluator fixes. #837

Merged
merged 7 commits into from
Jul 26, 2016
Merged

Python evaluator fixes. #837

merged 7 commits into from
Jul 26, 2016

Conversation

linas
Copy link
Member

@linas linas commented Jul 26, 2016

I believe that this will partially alleviate the problem described in opencog/opencog#2311 and in opencog/opencog#2315 and in opencog/opencog#2301 and in particular, Misgana's comment opencog/opencog#2301 (comment)

Basically, the way python was handling printing could not possibly work for anything that ran a python agent, or ran for a long time before returning. Right now, prints will always go to the cogserver stdout -- that will be recaptured in a different pull for the cogserver.

I cannot figure out how to interrupt python, so if you create an infinite loop, the only way to stop it is to kill the cogserver.

linas added 7 commits July 25, 2016 19:05
Debugging, trying to figure out what's actually going on in here.
Clearly, this cannot work when there are infinite loops, agents or
threads -- one could wait forever to see any print output.  Meanwhile,
the size of buffers grows without bound, as observed in comment
opencog/opencog#2301 (comment)
@bgoertzel
Copy link
Contributor

Regarding interrupting python ... I don't know the detailed context of the
current problem that well, but I dimly recall that eons ago I resorted to
this sort of crappery

http://effbot.org/zone/stupid-exceptions-keyboardinterrupt.htm

to make some python game I was writing be stoppable via control-C

Probably not applicable; just quasi-randomly brainstorming...

... ben

On Mon, Jul 25, 2016 at 11:04 PM, Linas Vepštas notifications@github.com
wrote:

Merged #837 #837.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#837 (comment), or mute
the thread
https://github.com/notifications/unsubscribe-auth/AFolXAwI2nL-_WRDKm8TbWQSDt6N74VOks5qZXkzgaJpZM4JUvli
.

Ben Goertzel, PhD
http://goertzel.org

Super-benevolent super-intelligence is the thought the Global Brain is
currently struggling to form...

@leungmanhin
Copy link
Contributor

btw it seems that this breaks the nlp-parse...

scheme@(guile-user)> (nlp-parse "hi")
ERROR: In procedure opencog-extension:
ERROR: Throw to key `C++-EXCEPTION' with args `("cog-evaluate!" "Python function 'call_sentiment_parse' did not return TruthValue! (/home/leungmanhin/hansonrobotics/opencog/atomspace/opencog/cython/PythonEval.cc:902)")'.

@ngeiswei
Copy link
Member

When removing all empty lines from function call_sentiment_parse in chat-utils.scm, the problem goes away. But obviously something is broken in the Python interpreter.

@ngeiswei
Copy link
Member

For this specific problem it looks like the following commit is causing troubles 8dda9e4

But there are other python errors, such as Python error : No module named rosgraph.

if (0 == part_size and
'\n' != partial_expr[0] and
'\r' != partial_expr[0])
goto wait_for_more;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@linas I don't understand what you want to fix here, the former code (0 < partion_exp.size()) looks perfectly good to me. The problem with your fix is that the following code

def fun(x):
   y = x + 1

   return y

fails because return y is considered part of a subsequent block.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants