Message11139
I have looked at this a bit more and have a few more examples which seem strange
>>> print "some text
File "<stdin>", line 1
print "some text
^
SyntaxError: no viable alternative at input '<EOF>'
>>> exec('print "some text')
>>> exec('print \'some text')
>>>
print "some text - correctly produces a SyntaxError however exec('print "some text') just prints a blank line like exec('print') would. This behaviour is also reproduced with a escaped single quote.
If you call print('some text') then it always seems to work correctly
>>> print("some text
File "<stdin>", line 1
print("some text
^
SyntaxError: no viable alternative at input '<EOF>'
>>> print("some text)
File "<stdin>", line 1
print("some text)
^
SyntaxError: no viable alternative at input '<EOF>'
>>> print("some text")
some text
>>> print('some text
File "<stdin>", line 1
print('some text
^
SyntaxError: no viable alternative at input '<EOF>'
>>> print('some text)
File "<stdin>", line 1
print('some text)
^
SyntaxError: no viable alternative at input '<EOF>'
>>> print('some text')
some text
>>> exec('print('some text')')
File "<stdin>", line 1
exec('print('some text')')
^
SyntaxError: no viable alternative at input 'some'
>>> exec('print(\'some text\')')
some text
>>> exec('print("some text")')
some text
>>> |
|
Date |
User |
Action |
Args |
2017-02-27 18:56:16 | jamesmudd | set | messageid: <1488221776.41.0.555909242335.issue2466@psf.upfronthosting.co.za> |
2017-02-27 18:56:16 | jamesmudd | set | recipients:
+ jamesmudd, fwierzbicki, zyasoft, pradeeppanayal, ldias |
2017-02-27 18:56:16 | jamesmudd | link | issue2466 messages |
2017-02-27 18:56:16 | jamesmudd | create | |
|