Open linas opened 8 years ago
One reason the telnet shell is broken is that we have no unit tests for it. Once upon a time, it used to work.
python results are discarded so it's difficult to test it. Agreed it is broken, but I guess we'll address that more deeply after the demo.
I sort of got it working Code like this works fine
for i in range(10) :
print "foo", i
but code like the one u posted with the empty line inside a scope doesn't work because like the standard interpreter, an empty line ends a scope(when typed in). https://github.com/Dagiopia/atomspace/blob/master/opencog/cython/PythonEval.cc
I stubbed out line 107 of tests/cython/PythonModuleUTest.cxxtest until this issue is resolved. When this bug is fixed, then that line should be enabled again.
See comments in pull request opencog/atomspace#838
At this time, starting the cogserver, and then
telnet localhost 17001
, entering the python shell, and entering this:produces no output in either the shell or the cogserver (see also issue opencog/cogserver#2 -- currently prints go to the cogserver; once fixed, prints should go to the shell.) There are also various inconsistencies: running the python shell stand-alone gives this:
after hitting carriage return 3 times. Doing the same in the telnet terminal gives this:
There are also inconsistencies in what python considers to be "legal syntax". For example, the following code, when entered at the python shell, is invalid syntax:
it generates this error:
however, copying that code to a file, say
f.py
and running it as$ python f.py
does not produce any error:running the above code at the telnet prompt does nothing.
I'm not sure quite how to resolve this ... if python itself is not self-consistent with what it considers to be valid syntax, I'm not sure how how to emulate that .. at any rate, the telnet shell is clearly broken.