Message13024
2.7.2 does not search modules in current directory when called with -m option. These modules are loaded on jython console and '-c' option.
$ ls mymodule/
__init__.py __main__.py
$ java -jar /path/to/jython/jython-standalone-2.7.2.jar -c 'import mymodule'
(no errors)
$ java -jar /path/to/jython/jython-standalone-2.7.2.jar -m mymodule
/path/to/jython/bin/jython: No module named mymodule
I found that when jython is called with -m, it does not have current directroy ('') unless explicitly specified with JYTHONPATH.
$ pwd
/home/user/jythontest
$ java -jar /path/to/jython/jython-standalone-2.7.2.jar -c 'import sys; print(sys.path)'
['', '/path/to/jython/Lib', '/path/to/jython/jython-standalone-2.7.2.jar/Lib', '__classpath__', '__pyclasspath__/']
$ java -jar /path/to/jython/jython-standalone-2.7.2.jar -m site
sys.path = [
'/path/to/jython/Lib',
'/path/to/jython/jython-standalone-2.7.2.jar/Lib',
'__classpath__',
'__pyclasspath__/',
]
USER_BASE: '/home/user/.local' (exists)
USER_SITE: '/home/user/.local/lib/jython2.7/site-packages' (doesn't exist)
ENABLE_USER_SITE: True
$ JYTHONPATH="." java -jar /path/to/jython/jython-standalone-2.7.2.jar -m site
sys.path = [
'/home/user/jythontest',
'/path/to/jython/Lib',
'/path/to/jython/jython-standalone-2.7.2.jar/Lib',
'__classpath__',
'__pyclasspath__/',
]
On 2.7.1, `-m site` shows current directory as the first item of sys.path.
$ java -jar /path/to/jython/jython-standalone-2.7.1.jar -m site
sys.path = [
'/home/user/jythontest',
'/path/to/jython/Lib',
'/path/to/jython/jython-standalone-2.7.1.jar/Lib',
'__classpath__',
'__pyclasspath__/',
] |
|
Date |
User |
Action |
Args |
2020-04-18 05:48:40 | rad164 | set | messageid: <1587188920.36.0.106055845428.issue2872@roundup.psfhosted.org> |
2020-04-18 05:48:40 | rad164 | set | recipients:
+ rad164 |
2020-04-18 05:48:40 | rad164 | link | issue2872 messages |
2020-04-18 05:48:40 | rad164 | create | |
|