From: Sébastien B. <seb...@te...> - 2016-05-13 15:59:32
|
Hi all, I have currently a problem with imports I do not understand. This is what happens (Jython 2.7.0, java 1.8.0u66, on debian 8): ----8< ---- 8< ---- ./jython.sh Jython 2.7.0 (default:9987c746f838, Apr 29 2015, 02:25:11) [Java HotSpot(TM) 64-Bit Server VM (Oracle Corporation)] on java1.8.0_66 Type "help", "copyright", "credits" or "license" for more information. >>> import sys; sys.path ['', '/path/to/XMCDA-java.jar', '/home/bigaret/lang/python/Lib', '/home/bigaret/lang/python/jython-standalone-2.7.0.jar/Lib', '__classpath__', '__pyclasspath__/'] >>> import org.xmcda.parsers.xml # this one fails here.... Traceback (most recent call last): File "<stdin>", line 1, in <module> ImportError: No module named xmcda >>> from org.xmcda.parsers.xml.xmcda_3_0 import XMCDAParser >>> import org.xmcda.parsers.xml # ...but now it succeeds >>> org.xmcda.parsers.xml <java package org.xmcda.parsers.xml 0x2> >>> sys.path ['', '/path/to/XMCDA-java.jar', '/home/bigaret/lang/python/Lib', '/home/bigaret/lang/python/jython-standalone-2.7.0.jar/Lib', '__classpath__', '__pyclasspath__/'] ----8< ---- 8< ---- Note that the first import fails, while the last (which is the same statement) succeeds --and sys.path was untouched, there is just an import between the two identical imports) Does someone has any hint why I get such a strange behaviour, or can point me to the right documentation to read? I could unfortunately not find any hint on such peculiarities when searching in jython's doc or on the web in general. Thanks in advance, __ Sébastien. NB: The jython.sh is a simple bash script: ----8< ---- 8< ---- #! /bin/bash JAVA=/usr/local/java8/bin/java JYTHON_STANDALONE_JAR=/home/bigaret/lang/python/jython-standalone-2.7.0.jar XMCDA_LIB="/path/to/XMCDA-java.jar" export JYTHONPATH="${XMCDA_LIB}" "${JAVA}" -cp "${JYTHON_STANDALONE_JAR}" org.python.util.jython ----8< ---- 8< ---- (and I have the same behaviour when adding XMCDA_LIB to the java '-cp' argument. -- Sébastien Bigaret Institut Mines-Télécom - Télécom Bretagne (Département LUSSI) CNRS - UMR 6285 Lab-STICC (Pôle CID - Équipe DECIDE) Technopôle Brest-Iroise - CS 83818 - 29238 Brest Cedex 3 - France Tél. +33 (0)2 29 00 14 22 |