mirror of
https://github.com/python/cpython
synced 2026-09-29 09:40:29 +03:00
Add current dir or paths of file args to sys.path.
This commit is contained in:
parent
a6dff3e772
commit
8e47306b99
1 changed files with 7 additions and 0 deletions
|
|
@ -612,6 +612,13 @@ def main():
|
|||
if args:
|
||||
for filename in sys.argv[1:]:
|
||||
flist.open(filename)
|
||||
aPath = os.path.abspath(os.path.dirname(filename))
|
||||
if not aPath in sys.path:
|
||||
sys.path.insert(0, aPath)
|
||||
else:
|
||||
aPath = os.getcwd()
|
||||
if not aPath in sys.path:
|
||||
sys.path.insert(0, aPath)
|
||||
t = PyShell(flist)
|
||||
flist.pyshell = t
|
||||
t.begin()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue