Re: Import error with maven
Jim Baker <[email protected]>
| Newsgroups | gmane.comp.lang.jython.user |
|---|---|
| Message-ID | <CAOhO=aM4VapqfvKazxhEfE35xnJvuhJNftqDKMRbM5WmbMfg6Q@mail.gmail.com> |
python.home is a very important setting for Jython, since it is used to set sys.prefix and sys.exec_prefix and corresponding paths. However, it usually can be inferred by PySystemState#findRoot, but this inference was broken for a python.home that was set to an empty string, and was just fixed in a commit today: https://hg.python.org/jython/rev/b0d8aed3a8cd The other change this commit introduced is that any ImportError that is raised during the import of the site module now provides in its message some additional diagnostic information, including how sys.path is being set. If you can build Jython 2.7 ( https://wiki.python.org/jython/JythonDeveloperGuide), please take a look and see how this changeset works for you. We should also have a release candidate ready very soon. On Wed, Mar 18, 2015 at 4:37 PM, Piotr Petunov <[email protected]> wrote: > Hello, > > I'm trying to use Jython as a Java adapter for a Python library. I have > built a basic maven project for this purpose. It has java files in the > /src/main/java/ folder and python files in the /src/main/resources/Lib > folder. Java side works ok, but I can't get it to detect Lib folder, > importing custom modules from Java classes causes import error. Python.home > isn't defined at all. The version of Jython I used was 2.7-b4. This jar is > supposed to work on different setups with different operating systems, > therefore I can't use full path for python.home. > > Is it supposed to work without setting python.home? If not, can I use > relative paths? Do you have any recommendations as to what should the > relative path be for a jar where python scripts are stored in the Lib > folder in the root folder of a jar? Thanks in advance. > > Regards, > Piotr Petunov > > > ------------------------------------------------------------------------------ > Dive into the World of Parallel Programming The Go Parallel Website, > sponsored > by Intel and developed in partnership with Slashdot Media, is your hub for > all > things parallel software development, from weekly thought leadership blogs > to > news, videos, case studies, tutorials and more. Take a look and join the > conversation now. http://goparallel.sourceforge.net/ > _______________________________________________ > Jython-users mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/jython-users > > -- - Jim jim.baker@{colorado.edu|python.org|rackspace.com|zyasoft.com} twitter.com/jimbaker github.com/jimbaker bitbucket.com/jimbaker ------------------------------------------------------------------------------ Dive into the World of Parallel Programming The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/ _______________________________________________ Jython-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/jython-users