eryk sun wrote: > On 10/22/18, boB Stepp <robertvst...@gmail.com> wrote: >> >> Importing the various program modules/module contents is >> no issue. Where I believe I need to know the paths to things are to >> get to data folders, config files, and occasionally utility programs >> that I have written that are on my hard drive, but not copied to my >> current program suite. > > It's common to use __file__ for a portable application, except you > should use sys.executable if it's a frozen executable, i.e. if > sys.frozen exists. > > For an installed application, limit this approach to the application's > immutable resources. Don't use the installation directory to store > modifiable data. You may not have write access (e.g. a system > installation and the user lacks root/admin access, or it's an > immutable directory or read-only disk mount).
I've not tried it, but for per-app read-only data importlib.resources appears to be the right tool. https://docs.python.org/dev/library/importlib.html#module-importlib.resources _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor