1

I’ve packaged some python scripts in a jar using the method described here: Distributing my Python scripts as JAR files with Jython?

This worked fine, but I’m having trouble getting to the base path of the jar my script is in. At the moment, the workaround I’ve found was to cd to the directory the jar is in and retrieve the path with os.getcwd().

Using os.path.realpath(__file__) gives me /path/to/jar/myapplication.jar/Lib/module/file.py.

Is there a variable like __file__ that would give me /path/to/jar/myapplication.jar instead ?

The reason is I have some configuration file externalized that I would like to retrieve based on a relative path to my application.

Community
  • 1
  • 1

1 Answers1

1

seems like sys.exec_prefix is what I’m looking for.