mirror of https://github.com/python/cpython.git
When IDLE is installed and run from a startup script, the script's
directory becomes sys.path[0]. What is wanted is the directory from which IDLE was called. Insert the current working directory in the path if it isn't there already.
This commit is contained in:
parent
dd70e1be91
commit
ff002b9305
|
@ -29,6 +29,7 @@
|
||||||
import rpc
|
import rpc
|
||||||
import RemoteDebugger
|
import RemoteDebugger
|
||||||
|
|
||||||
|
# Preserve 2.2 compatibility for Mac OS X:
|
||||||
import boolcheck
|
import boolcheck
|
||||||
|
|
||||||
IDENTCHARS = string.ascii_letters + string.digits + "_"
|
IDENTCHARS = string.ascii_letters + string.digits + "_"
|
||||||
|
@ -1169,6 +1170,10 @@ def main():
|
||||||
dir = os.path.abspath(dir)
|
dir = os.path.abspath(dir)
|
||||||
if not dir in sys.path:
|
if not dir in sys.path:
|
||||||
sys.path.insert(0, dir)
|
sys.path.insert(0, dir)
|
||||||
|
else:
|
||||||
|
dir = os.getcwd()
|
||||||
|
if not dir in sys.path:
|
||||||
|
sys.path.insert(0, dir)
|
||||||
# check the IDLE settings configuration (but command line overrides)
|
# check the IDLE settings configuration (but command line overrides)
|
||||||
edit_start = idleConf.GetOption('main', 'General',
|
edit_start = idleConf.GetOption('main', 'General',
|
||||||
'editor-on-startup', type='bool')
|
'editor-on-startup', type='bool')
|
||||||
|
|
Loading…
Reference in New Issue