0

I am creating a python library. In that library i have a bunch of Avro schema files. Everything works for the moment. But, if the module is deployed and pulled in as a zip file, this won't work

schema = avro.schema.parse(open(os.path.join(root_dir, file), "r").read())

that won't work if the client installs the lib as a zip instead of a standard source build.

Whats the most reliable python way of opening a text file stored in a common distributable?

Should I just begin using importlib_resources right from the start with these files?

scphantm
  • 4,293
  • 8
  • 43
  • 77
  • Make your library `zip_safe=False`..? Also see ["including other files"](https://packaging.python.org/en/latest/tutorials/packaging-projects/#including-other-files). – AKX Nov 09 '22 at 19:58

0 Answers0