Skip to content

Commit 933b01f

Browse files
committed
fix bug of sys.path
1 parent 5291be2 commit 933b01f

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

changelog.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
# Changelogs
33

44

5+
- 2022.03.10
6+
- fix bug of `sys.path` missing the parent of `__file__` while running `python venv.pyz xx.py`
57
- 2022.03.07
68
- fix bug of version `2022.03.06`
79
- file xxx.template not found

zipapps/_entry_point.py.template

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,12 @@ def main():
8080
sys.argv = args[2:]
8181
return run_module(args[2], run_name='__main__')
8282
else:
83-
if Path(arg1).is_file():
83+
arg1_path = Path(arg1)
84+
if arg1_path.is_file():
8485
sys.argv = args[1:]
86+
dir_path = arg1_path.parent
87+
if dir_path.is_dir():
88+
sys.path.insert(0, dir_path.absolute().as_posix())
8589
return run_path(arg1, run_name='__main__')
8690
else:
8791
# python [-bBdEhiIOqsSuvVWx?]

zipapps/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
from pkgutil import get_data
1515
from zipfile import ZIP_DEFLATED, ZIP_STORED, BadZipFile, ZipFile
1616

17-
__version__ = '2022.03.07'
17+
__version__ = '2022.03.10'
1818

1919

2020
def get_pip_main(ensurepip_root=None):

0 commit comments

Comments
 (0)