-
Notifications
You must be signed in to change notification settings - Fork 25
Description
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:
for i in range(10) :
print "foo", i
produces no output in either the shell or the cogserver (see also issue #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:
$ python
Python 2.7.6 (default, Jun 22 2015, 17:58:13)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>
>>>
>>>
>>>
after hitting carriage return 3 times. Doing the same in the telnet terminal gives this:
$ telnet localhost 17001
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
opencog> py
Entering python shell; use ^D or a single . on a line by itself to exit.
py>
...
...
py>
py>
...
...
...
...
...
...
py>
...
...
...
...
py>
...
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:
def fun(x):
y = x + 1
print "foo", y
return y
fun(1)
print "bar"
it generates this error:
$ python
Python 2.7.6 (default, Jun 22 2015, 17:58:13)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> def fun(x):
... y = x + 1
...
>>> print "foo", y
File "<stdin>", line 1
print "foo", y
^
IndentationError: unexpected indent
>>>
however, copying that code to a file, say f.py
and running it as $ python f.py
does not produce any error:
$ python f.py
foo 2
bar
$
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.