Message12163
Example 1: pyinfo.py[1]
---------------------
def pyinfo():
import sys
<BLANK>
return {"version_info": tuple(sys.version_info), "sysplatform": sys.platform}
<BLANK>
print(pyinfo())
---------------------------------
1) If you run this file like:
jython pyinfo.py
it just runs fine, i.e.
{'version_info': (2, 7, 1, 'final', 0), 'sysplatform': 'java1.7.0_181 ( ==linux2 for targets )'}
2) But if you feed the file into the interpreter standard input stream,
jython < pyinfo.py
it spits out syntax error:
File "<stdin>", line 1
return {"version_info": tuple(sys.version_info), "sysplatform": sys.platform}
^
SyntaxError: no viable alternative at input ' '
3) If you remove the first blank line, i.e.
def pyinfo():
import sys
return {"version_info": tuple(sys.version_info), "sysplatform": sys.platform}
<BLANK>
print(pyinfo())
you can run the code by giving file name as an argument AND by feeding into standard input.
This problem prevents using a Jython interpreter in tox environment.
Testing environment
-------------------
Debian 8.11 Jessie
OpenJDK 1.7.0_181
OpenJDK Runtime Environment (IcedTea 2.6.14) (7u181-2.6.14-1~deb8u1)
OpenJDK 64-Bit Server VM (build 24.181-b01, mixed mode)
Jython 2.7.1
------
[1] tox feed this code into python interpreter's standard input |
|
Date |
User |
Action |
Args |
2018-10-27 06:15:50 | mete0r | set | recipients:
+ mete0r |
2018-10-27 06:15:50 | mete0r | set | messageid: <1540620950.79.0.788709270274.issue2712@psf.upfronthosting.co.za> |
2018-10-27 06:15:50 | mete0r | link | issue2712 messages |
2018-10-27 06:15:49 | mete0r | create | |
|