kryten icon indicating copy to clipboard operation
kryten copied to clipboard

fixed some Python statement regarded as shell command

Open fengsp opened this issue 12 years ago • 0 comments

I try the example play file:

python kryten.py -d 0.05 -n -p python101.play

It turns out that I get the following errors:

....5> a = 'hello world' /bin/sh: a: command not found ....6> a = [1,2,3] /bin/sh: a: command not found ....7> b = a /bin/sh: b: command not found ....8> print a, b | Traceback (most recent call last): | File "kryten.py", line 675, in play | if not actor(command,code,history,options): | File "kryten.py", line 545, in actor | exec(command,_env) | File "", line 1, in | NameError: name 'a' is not defined ....9> b[1] = 7 | Traceback (most recent call last): | File "kryten.py", line 675, in play | if not actor(command,code,history,options): | File "kryten.py", line 545, in actor | exec(command,_env) | File "", line 1, in | NameError: name 'b' is not defined ...10> print a, b | Traceback (most recent call last): | File "kryten.py", line 675, in play ...

I tryed it on my Mac OS X, so I thought it might be a OS specific thing. Then I tryed the same script on my Ubuntu, I get the same error.

It turns out that "a=4" works fine, "a = 4" fails because it is regarded as a shell command.

And when "print 5", I see nothing on the terminal, finally I see "set_color('black')", and my terminal's background color is black, oops, maybe add some options?

fengsp avatar Oct 28 '13 04:10 fengsp