Consider this script /tmp/test.py
:
import os
import sys
print(__file__)
print(os.path.dirname(os.path.realpath(__file__)))
print(sys.argv)
bundled like this with pex
:
python -m pex --exe test.py -o test.pex
Executing ./test.pex
gives:
/home/user/.cache/pex/unzipped_pexes/1/05ee97ddfe7a3cfe9392492e49c46d07135e26d9/__pex_executable__.py
/home/user/.cache/pex/user_code/0/242a6d4429f13194d3dedebc8dbd8d72bf0c79bd
['/home/user/.cache/pex/unzipped_pexes/1/05ee97ddfe7a3cfe9392492e49c46d07135e26d9/__pex_executable__.py']
How can I get the name and path of the executed .pex file?
Consider this script /tmp/test.py
:
import os
import sys
print(__file__)
print(os.path.dirname(os.path.realpath(__file__)))
print(sys.argv)
bundled like this with pex
:
python -m pex --exe test.py -o test.pex
Executing ./test.pex
gives:
/home/user/.cache/pex/unzipped_pexes/1/05ee97ddfe7a3cfe9392492e49c46d07135e26d9/__pex_executable__.py
/home/user/.cache/pex/user_code/0/242a6d4429f13194d3dedebc8dbd8d72bf0c79bd
['/home/user/.cache/pex/unzipped_pexes/1/05ee97ddfe7a3cfe9392492e49c46d07135e26d9/__pex_executable__.py']
How can I get the name and path of the executed .pex file?
Share Improve this question asked Mar 25 at 8:08 spinkusspinkus 8,5704 gold badges44 silver badges72 bronze badges1 Answer
Reset to default 1PEX applications expose a PEX environment variable that is the absolute path of the PEX file.
print(os.environ["PEX"])
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744211328a4563346.html
评论列表(0条)