prehistoric-motorcycle-70707
08/23/2023, 7:35 PMbroad-processor-92400
08/23/2023, 8:06 PMimportlib.resources.
• use __file__ to reference the location of the current Python file and then traverse from there
The first option is more resilient to weirder and wackier deploy options, but that might not be necessary when you’re in control of the deploy like you seem to be (ie not publishing a library to PyPI)prehistoric-motorcycle-70707
08/23/2023, 8:20 PM__file__ will work! We arent publishing any packages, and its all internal stuff. So even if its less resilient, I think itll work.
Thanks for your response!broad-processor-92400
08/23/2023, 8:44 PMimportlib.resources takes a bit of getting used to. I would offer code examples but I’m on a phone... As you say, __file__ seems good for your use casebroad-processor-92400
08/23/2023, 8:46 PMresources(...) target, not files(…), or else it won’t be included in the zipprehistoric-motorcycle-70707
08/23/2023, 8:57 PM