__pyclasspath__ not expanded in __file__

"Niemann, Hartmut" <[email protected]> Mon, 16 Mar 2020 18:11:55 +0000
Newsgroups gmane.comp.lang.jython.devel
Message-ID <AM6PR10MB25683E709415BBE332210C83FCF90@AM6PR10MB2568.EURPRD10.PROD.OUTLOOK.COM>
Hello!

I have written a python program using the graphics library pygal.

There is one module of that library that tries to find a resource file like this
                    css = os.path.join(
                        os.path.dirname(__file__), 'css', css)
This works fine with (c) Python, this works fine with jython.exe (version 2.7.0, if that matters).
But (because of some company standard) the main program of my application is a java class, starting the jython interpreter like this:

                               PythonInterpreter.initialize(null, null, argv.toArray(new String[0]));

                               PythonInterpreter py;
                               py = new PythonInterpreter();

                               //exec
                               py.exec("import icmgen_py");

                               PyObject ret;
                               ret = py.eval("icmgen_py.main()");

To make things even more complicated, the java and python source is packed into one exe with launch4j.
But if I run my application from this launch4j executable, __file__ expands to
__pyclasspath__/pygal/svg.py

Why does jython have proper __file__ values if started with jython.exe, but does not expand __pyclasspath__ to the real (probably temporary root) directory if run from a java class like above?

Any ideas?

With best regards
Hartmut Niemann

_______________________________________________
Jython-dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jython-dev