https://pantsbuild.org/ logo
#pex
Title
# pex
a

aloof-painter-75660

03/30/2017, 6:51 PM
I've been trying to find information about accessing non-py files from within a built pex, and haven't been able to find much. So my app has translation files, as well as some template files to be used with Jinja, and if I build with pants the absolute path (e.g.
os.path.join(os.path.abspath(os.path.dirname(__file__)), TEMPLATE_DIR)))
) the path always starts with the
.pex
file as if it were a directory. Resulting in something like:
/app/server.pex/data/something
, but
server.pex
is not a directory and any
open()
call to a file with this directory prefix will cause an IOError.