Re: ImportError: No module named site
Alex Grönholm <[email protected]>
| Newsgroups | gmane.comp.lang.jython.devel |
|---|---|
| Message-ID | <[email protected]> |
05.03.2015, 20:02, David Charles kirjoitti: > Thank you, Alex! > > Setting python.home to the user's home directory, in combination with > the recipe you provided *worked* for me too, so I am now able to > webstart my application on jython2.7b3! Do you have an account on > stackoverflow? Would you be interesting in providing your answer there? > I have an account. Can you point me to the question you asked there? > In the process of testing, I opened the Windows Task Manager and > discovered that my client machine was choking on a large number of > javaws.exe and jp2launcher.exe processes! I do not know where these > came from, because I was bouncing back and forth between jython2.7b3 > and jython2.7b4. But, I do have at least one confirmed instance of > jython2.7b4 leaving behind a jp2launcher.exe with a 500M footprint. > > On jython2.7b4, my application *does* webstart, but it hangs almost > immediately after webstarting, at the very place where I attempt to > initialize the JavaFX runtime. (I was at one time breaking the Python > rule against starting a thread and waiting for it in the midst of a > module import, but that is fixed now.) The same application starts > without issue when I run it locally, without webstart. > > David > > On Wed, Mar 4, 2015 at 7:19 PM, Alex Grönholm > <[email protected] <mailto:[email protected]>> wrote: > > 03.03.2015, 19:08, David Charles kirjoitti: >> Hi Alex, >> >> I am reporting back. I believe I followed your recipe perfectly >> with jython-standalone-2.7-b3 and now my application fails to >> start with a different exception stack trace. Perhaps my error >> is obvious to you. >> > Yes, I encountered the same problem. You should set the > python.home system property to something, anything. My code sets > it to the user's home directory, but anything should do as long as > it exists (AFAIK). > >> Traceback (most recent call last): >> File "__pyclasspath__/site$py.class", line 571, in <module> >> File "__pyclasspath__/site$py.class", line 553, in main >> File "__pyclasspath__/site$py.class", line 286, in >> addusersitepackages >> File "__pyclasspath__/site$py.class", line 261, in >> getusersitepackages >> File "__pyclasspath__/site$py.class", line 250, in getuserbase >> File "__pyclasspath__/sysconfig$py.class", line 112, in <module> >> File "__pyclasspath__/ntpath$py.class", line 402, in normpath >> AttributeError: 'NoneType' object has no attribute 'startswith' >> >> at org.python.core.Py.AttributeError(Py.java:177) >> at org.python.core.PyObject.noAttributeError(PyObject.java:946) >> at org.python.core.PyObject.__getattr__(PyObject.java:941) >> at >> ntpath$py.normpath$15(/home/12345/builds/myapp/webstart/tmp/Lib/ntpath.py:447) >> at >> ntpath$py.call_function(/home/12345/builds/myapp/webstart/tmp/Lib/ntpath.py) >> at org.python.core.PyTableCode.call(PyTableCode.java:166) >> at org.python.core.PyBaseCode.call(PyBaseCode.java:137) >> at org.python.core.PyFunction.__call__(PyFunction.java:347) >> at >> sysconfig$py.f$0(/home/12345/builds/myapp/webstart/tmp/Lib/sysconfig.py:712) >> at >> sysconfig$py.call_function(/home/12345/builds/myapp/webstart/tmp/Lib/sysconfig.py) >> at org.python.core.PyTableCode.call(PyTableCode.java:166) >> at org.python.core.PyCode.call(PyCode.java:18) >> at org.python.core.imp.createFromCode(imp.java:393) >> at >> org.python.core.util.importer.importer_load_module(importer.java:109) >> at >> org.python.core.ClasspathPyImporter.ClasspathPyImporter_load_module(ClasspathPyImporter.java:63) >> at >> org.python.core.ClasspathPyImporter$ClasspathPyImporter_load_module_exposer.__call__(Unknown >> Source) >> at >> org.python.core.PyBuiltinMethodNarrow.__call__(PyBuiltinMethodNarrow.java:47) >> at org.python.core.imp.loadFromLoader(imp.java:520) >> at org.python.core.imp.find_module(imp.java:474) >> at org.python.core.imp.import_next(imp.java:737) >> at org.python.core.imp.import_module_level(imp.java:856) >> at org.python.core.imp.importName(imp.java:946) >> at org.python.core.ImportFunction.__call__(__builtin__.java:1301) >> at org.python.core.PyObject.__call__(PyObject.java:373) >> at org.python.core.__builtin__.__import__(__builtin__.java:1254) >> at org.python.core.imp.importFromAs(imp.java:1040) >> at org.python.core.imp.importFrom(imp.java:1016) >> at >> site$py.getuserbase$9(/home/12345/builds/myapp/webstart/tmp/Lib/site.py:252) >> at >> site$py.call_function(/home/12345/builds/myapp/webstart/tmp/Lib/site.py) >> at org.python.core.PyTableCode.call(PyTableCode.java:166) >> at org.python.core.PyBaseCode.call(PyBaseCode.java:123) >> at org.python.core.PyFunction.__call__(PyFunction.java:337) >> at >> site$py.getusersitepackages$10(/home/12345/builds/myapp/webstart/tmp/Lib/site.py:276) >> at >> site$py.call_function(/home/12345/builds/myapp/webstart/tmp/Lib/site.py) >> at org.python.core.PyTableCode.call(PyTableCode.java:166) >> at org.python.core.PyBaseCode.call(PyBaseCode.java:123) >> at org.python.core.PyFunction.__call__(PyFunction.java:337) >> at >> site$py.addusersitepackages$11(/home/12345/builds/myapp/webstart/tmp/Lib/site.py:290) >> at >> site$py.call_function(/home/12345/builds/myapp/webstart/tmp/Lib/site.py) >> at org.python.core.PyTableCode.call(PyTableCode.java:166) >> at org.python.core.PyBaseCode.call(PyBaseCode.java:137) >> at org.python.core.PyFunction.__call__(PyFunction.java:347) >> at >> site$py.main$34(/home/12345/builds/myapp/webstart/tmp/Lib/site.py:569) >> at >> site$py.call_function(/home/12345/builds/myapp/webstart/tmp/Lib/site.py) >> at org.python.core.PyTableCode.call(PyTableCode.java:166) >> at org.python.core.PyBaseCode.call(PyBaseCode.java:123) >> at org.python.core.PyFunction.__call__(PyFunction.java:337) >> at >> site$py.f$0(/home/12345/builds/myapp/webstart/tmp/Lib/site.py:623) >> at >> site$py.call_function(/home/12345/builds/myapp/webstart/tmp/Lib/site.py) >> at org.python.core.PyTableCode.call(PyTableCode.java:166) >> at org.python.core.PyCode.call(PyCode.java:18) >> at org.python.core.imp.createFromCode(imp.java:393) >> at >> org.python.core.util.importer.importer_load_module(importer.java:109) >> at >> org.python.core.ClasspathPyImporter.ClasspathPyImporter_load_module(ClasspathPyImporter.java:63) >> at >> org.python.core.ClasspathPyImporter$ClasspathPyImporter_load_module_exposer.__call__(Unknown >> Source) >> at >> org.python.core.PyBuiltinMethodNarrow.__call__(PyBuiltinMethodNarrow.java:47) >> at org.python.core.imp.loadFromLoader(imp.java:520) >> at org.python.core.imp.find_module(imp.java:474) >> at org.python.core.imp.import_next(imp.java:737) >> at org.python.core.imp.import_first(imp.java:758) >> at org.python.core.imp.load(imp.java:633) >> at >> org.python.util.PythonInterpreter.<init>(PythonInterpreter.java:126) >> at >> org.python.util.PythonInterpreter.<init>(PythonInterpreter.java:104) >> at >> org.python.util.InteractiveInterpreter.<init>(InteractiveInterpreter.java:16) >> at >> org.python.util.InteractiveInterpreter.<init>(InteractiveInterpreter.java:12) >> at >> org.python.util.InteractiveConsole.<init>(InteractiveConsole.java:35) >> at >> org.python.util.InteractiveConsole.<init>(InteractiveConsole.java:27) >> at >> org.python.util.InteractiveConsole.<init>(InteractiveConsole.java:19) >> (etc.) >> >> David >> >> >> On Mon, Mar 2, 2015 at 11:42 AM, Alex Grönholm >> <[email protected] <mailto:[email protected]>> wrote: >> >> 02.03.2015, 19:42, Alex Grönholm kirjoitti: >>> 02.03.2015, 19:34, David Charles kirjoitti: >>>> Alex, >>>> >>>> Thank you for your reply. Yes, I am using the standalone >>>> jar. Here are my file sizes: >>>> >>>> $ ls -l jython-standalone* >>>> -rw-r--r-- 1 12345 users 13432713 Jun 12 2013 >>>> jython-standalone-2.7-b1.jar >>>> -rw-r--r-- 1 12345 users 28913501 Nov 4 14:25 >>>> jython-standalone-2.7-b3.jar >>>> -rw-r--r-- 1 12345 users 35018318 Feb 26 16:14 >>>> jython-standalone-2.7-b4.jar >>>> >>>> The only one that works for me is b1. On the client, I am >>>> using javaws -clearcache between tests. >>>> >>> Ok, Jim Baker just reminded me of something. I in fact >>> deployed a slightly customized jython jar with Web Start. I >>> ran "jython -m compileall ." in the Lib directory and then >>> moved it to the root of the jar (deleting all .py files and >>> the actual Lib directory afterwards). That is what's working >>> for me in production. I hope this helps. >> I just wrote a script that will do the same automatically for >> any standalone jython jar: >> https://gist.github.com/agronholm/48d5eda810588dfed2db >> >>>> Wow, jython-standalone-2.7-b4.jar is 34Mb? >>>> >>>> David >>>> >>>> >>>> >>>> On Mon, Mar 2, 2015 at 9:49 AM, Alex Grönholm >>>> <[email protected] >>>> <mailto:[email protected]>> wrote: >>>> >>>> 02.03.2015, 18:43, David Charles kirjoitti: >>>>> My apologies for abusing this list a second time, but >>>>> I am still unable to register at bugs.jython.org >>>>> <http://bugs.jython.org>. :( >>>>> >>>>> I am seeing "ImportError: No module named site" on >>>>> 2.7b4 as described in this issue: >>>>> >>>>> * http://bugs.jython.org/issue2225 >>>>> >>>>> However, mine is a Webstart application. >>>>> >>>>> My application is currently running properly on 2.7b1, >>>>> since that particular release does not exhibit the >>>>> symptom, but I would like to be using the latest if >>>>> possible. >>>>> >>>> I have a deployed Web Start app running 2.7b3 >>>> currently. Are you sure you downloaded the correct >>>> Jython jar file? What is the file size? The one you >>>> should have downloaded is the standalone jar. There is >>>> another jar which only contains the Java classes. >>>>> Here is what I see in the Webstart console when I >>>>> start my app: >>>>> >>>>> Java Web Start 11.31.2.13 >>>>> Using JRE version 1.8.0_31-b13 Java HotSpot(TM) 64-Bit >>>>> Server VM >>>>> User home directory = C:\Users\12345 >>>>> ---------------------------------------------------- >>>>> c: clear console window >>>>> f: finalize objects on finalization queue >>>>> g: garbage collect >>>>> h: display this help message >>>>> m: print memory usage >>>>> o: trigger logging >>>>> p: reload proxy configuration >>>>> q: hide console >>>>> r: reload policy configuration >>>>> s: dump system and deployment properties >>>>> t: dump thread list >>>>> v: dump thread stack >>>>> 0-5: set trace level to <n> >>>>> ---------------------------------------------------- >>>>> #### Java Web Start Error: >>>>> #### null >>>>> >>>>> When I click on 'Details', I find the following >>>>> exception stack trace: >>>>> >>>>> ImportError: No module named site >>>>> >>>>> at org.python.core.ImportError(Py.java:328) >>>>> at org.python.core.imp.import_first(imp.java:842) >>>>> at org.python.core.imp.load(imp.java:695) >>>>> at >>>>> org.python.util.PythonInterpreter.<init>(PythonInterpreter.java:118) >>>>> at >>>>> org.python.util.PythonInterpreter.<init>(PythonInterpreter.java:94) >>>>> at >>>>> org.python.util.InteractiveInterpreter.<init>(InteractiveInterpreter.java:39) >>>>> at >>>>> org.python.util.InteractiveInterpreter.<init>(InteractiveInterpreter.java:28) >>>>> at >>>>> org.python.util.InteractiveConsole.<init>(InteractiveConsole.java:67) >>>>> at >>>>> org.python.util.InteractiveConsole.<init>(InteractiveConsole.java:53) >>>>> at >>>>> org.python.util.InteractiveConsole.<init>(InteractiveConsole.java:33) >>>>> (my app) >>>>> >>>>> Is there anyone who can tell me what is going on and >>>>> how to fix it? >>>>> >>>>> Thank you, kindly. >>>>> David >>>>> >>>>> >>>>> >>>>> ------------------------------------------------------------------------------ >>>>> 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-dev mailing list >>>>> [email protected] <mailto:[email protected]> >>>>> https://lists.sourceforge.net/lists/listinfo/jython-dev >>>> >>>> >>>> ------------------------------------------------------------------------------ >>>> 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-dev mailing list >>>> [email protected] >>>> <mailto:[email protected]> >>>> https://lists.sourceforge.net/lists/listinfo/jython-dev >>>> >>>> >>> >> >> >> ------------------------------------------------------------------------------ >> 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-dev mailing list >> [email protected] >> <mailto:[email protected]> >> https://lists.sourceforge.net/lists/listinfo/jython-dev >> >> > > > ------------------------------------------------------------------------------ > 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-dev mailing list > [email protected] > <mailto:[email protected]> > https://lists.sourceforge.net/lists/listinfo/jython-dev > > ------------------------------------------------------------------------------ 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-dev mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/jython-dev