On this page
zipapp.get_interpreter
Prev: zipapp.create_archive | Up: zipapp | Next: zipapp.ZipAppError
Rel: zipapp.create_archive, zipapp.ZipAppError
Ref: docs.python.org — zipapp.get_interpreter
Tags: #public #python3 #stdlib #zipapp
Import
import zipapp
from zipapp import get_interpreter
Signature & Overview
zipapp.get_interpreter(archive)
zipapp.get_interpreter() function.
Usage
from pathlib import Path
import tempfile, zipapp
with tempfile.TemporaryDirectory() as tmp:
src = Path(tmp) / 'app'; src.mkdir()
(src / '__main__.py').write_text('pass\n')
out = Path(tmp) / 'app.pyz'
zipapp.create_archive(src, target=out, interpreter='/usr/bin/env python3')
assert zipapp.get_interpreter(out) == '/usr/bin/env python3'
Gotchas
- Returns
Noneif the archive was created without a#!shebang.
REPL Inspect
from zipapp import get_interpreter
help(get_interpreter)
Linked from
Related notes
- tuts/python3/stdlib_module/zipapp/create_archive Linked here; links to this page; shared tags: #stdlib, #zipapp
- tuts/python3/stdlib_module/zipapp/ZipAppError Linked here; links to this page; shared tags: #stdlib, #zipapp
- tuts/python3/stdlib_module/zipapp Linked here; links to this page; shared tags: #stdlib
- tuts/c/stdlib shared tags: #stdlib
- tuts/c/stdlib/assert shared tags: #stdlib
- tuts/c/stdlib/assert/assert shared tags: #stdlib
- tuts/c/stdlib/assert/static_assert shared tags: #stdlib
- tuts/c/stdlib/ctype shared tags: #stdlib
- tuts/c/stdlib/ctype/isalpha shared tags: #stdlib
- tuts/c/stdlib/ctype/isdigit shared tags: #stdlib