Message11447
When Jython 2.7.1-rc2 is executed from a network location under Windows, it fails to access any file from within the jar itself.
Reproducing the error with "Jython-standalone-2.7.1-rc2" is a little bit tricky. If we just open a command line and execute Jython, Windows automatically assigns a drive letter to the network location and Jython works just fine. The problem occurs, however, if we use "PowerShell" and carefully avoid assigning a letter to the network path.
Using standard java to start Jython results in the following output:
#############################################################################
$> java -jar jython-standalone-2.7.1-rc2.jar
*sys-package-mgr*: can't create package cache dir, '\\MY-PC\Shared\Jython\MY-PC\Shared\Jython\cachedir\packages'
Exception in thread "main" ImportError: Cannot import site module and its dependencies: No module named site
Determine if the following attributes are correct:
*sys.path: [\\\\MY-PC\\Shared\\Jython\\MY-PC\\Shared\\Jython\\Lib,__classpath__, __pyclasspath__/]
This attribute might be including the wrong directories, such as from CPython
*sys.prefix: \\\\MY-PC\\Shared\\Jython\\MY-PC\\Shared\\Jython
This attribute is set by the system property python.home, although it can
be often automatically determined by the location of the Jython jar file
You can use the -S option or python.import.site=false to not import the site module
#############################################################################
So, we try the -S option, yielding the following scenario. At first, everything seems fine, but then, the "random"-random cannot be found.
#############################################################################$> java -jar jython-standalone-2.7.1-rc2.jar -S
*sys-package-mgr*: can't create package cache dir, '\\MY-PC\Shared\Jython\MY-PC\Shared\Jython\cachedir\packages'
Jython 2.7.1rc2 (default:f66327aa5de9, May 29 2017, 17:56:49)
[Java HotSpot(TM) 64-Bit Server VM (Oracle Corporation)] on java1.8.0_131
>>> from random import randint
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named random
#############################################################################
Note how the path to jython.jar is obviously doubled:
\\\\MY-PC\\Shared\\Jython\\MY-PC\\Shared\\Jython
It seems that the path "MY-PC/Shared/Jython" lacks the proper reference to the "root", resulting in Java interpreting the path relative to the current directory instead.
The problem did not occur with Jython 2.7.0 |
|
Date |
User |
Action |
Args |
2017-06-25 15:53:37 | tkohn | set | recipients:
+ tkohn |
2017-06-25 15:53:37 | tkohn | set | messageid: <1498406017.84.0.385252178562.issue2599@psf.upfronthosting.co.za> |
2017-06-25 15:53:37 | tkohn | link | issue2599 messages |
2017-06-25 15:53:36 | tkohn | create | |
|