From: Niemann, H. <har...@si...> - 2020-03-17 00:42:08
|
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 |