Jython

Message13024

Author rad164
Recipients rad164
Date 2020年04月18日.05:48:40
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1587188920.36.0.106055845428.issue2872@roundup.psfhosted.org>
In-reply-to
Content
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__/',
 ]
History
Date User Action Args
2020年04月18日 05:48:40rad164setmessageid: <1587188920.36.0.106055845428.issue2872@roundup.psfhosted.org>
2020年04月18日 05:48:40rad164setrecipients: + rad164
2020年04月18日 05:48:40rad164linkissue2872 messages
2020年04月18日 05:48:40rad164create

Supported by Python Software Foundation,
Powered by Roundup

AltStyle によって変換されたページ (->オリジナル) /