0

I'm developing a python CLI which will allow users to edit default settings stored in a settings.txt file, but I don't know how to get the path to this file in my package or if there's a better way to access the file.

I'm using pkgutil.get_data(__package__, 'settings.txt').decode() when I want to use particular settings, so if I could use pkgutil that would be great

kynnemall
  • 855
  • 9
  • 26
  • https://stackoverflow.com/a/58941536/11138259 – sinoroc Jan 12 '21 at 21:01
  • You need 3 different things. First you need to package your default `settings.txt` correctly as a data resource file in one of your importable package. Second you need to be able to read that data resource file from your importable package at run-time (use `importlib.resources`). Third you need to find a user writable directory to copy the default file (use `appdirs`). – sinoroc Jan 12 '21 at 21:04

0 Answers0