JoshuaPHG
asked on
Invalid Python config directory
I am troubleshooting an install of Python 2.5.2 for Windows XP. I can open up the command line without issue. - My problem is wih IDLE. I know nothing about python, this is strictly "playing".
At the command line in the python directory I can try to start IDLE:
C:\Python25> python Lib/idlelib/idle.py
Warning: unable to create user config directory F:\.idlerc Check path and permissions.
Where is this path F:\coming from? It needs to be C:\.
At the command line in the python directory I can try to start IDLE:
C:\Python25> python Lib/idlelib/idle.py
Warning: unable to create user config directory F:\.idlerc Check path and permissions.
Where is this path F:\coming from? It needs to be C:\.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I in the Lib/idlelib directory I changed the configHandler.py script that you indicated.
Original:
def GetUserCfgDir(self):
"""
Creates (if required) and returns a filesystem directory for storing
user config files.
"""
cfgDir = '.idlerc'
userDir = os.path.expanduser('~')
if userDir != '~': # expanduser() found user home dir
if not os.path.exists(userDir):
warn = ('\n Warning: os.path.expanduser("~") points to\n '+
userDir+',\n but the path does not exist.\n')
sys.stderr.write(warn)
userDir = '~'
if userDir == "~": # still no path to home!
# traditionally IDLE has defaulted to os.getcwd(), is this adequate?
userDir = os.getcwd()
userDir = os.path.join(userDir, cfgDir)
if not os.path.exists(userDir):
try:
os.mkdir(userDir)
except (OSError, IOError):
warn = ('\n Warning: unable to create user config directory\n'+
userDir+'\n Check path and permissions.\n Exiting!\n\n')
sys.stderr.write(warn)
raise SystemExit
return userDir
New:
def GetUserCfgDir(self):
"""
Creates (if required) and returns a filesystem directory for storing
user config files.
"""
cfgDir = '.idlerc'
userDir = os.getcwd()
#userDir = os.path.expanduser('~')
#if userDir != '~': # expanduser() found user home dir
# if not os.path.exists(userDir):
# warn = ('\n Warning: os.path.expanduser("~") points to\n '+
# userDir+',\n but the path does not exist.\n')
# sys.stderr.write(warn)
# userDir = '~'
#if userDir == "~": # still no path to home!
# # traditionally IDLE has defaulted to os.getcwd(), is this adequate?
# userDir = os.getcwd()
userDir = os.path.join(userDir, cfgDir)
if not os.path.exists(userDir):
try:
os.mkdir(userDir)
except (OSError, IOError):
warn = ('\n Warning: unable to create user config directory\n'+
userDir+'\n Check path and permissions.\n Exiting!\n\n')
sys.stderr.write(warn)
raise SystemExit
return userDir
It works now, but I don't really like it. Essentially everything is remmed out except for the os.getcwd() part. Maybe I should just have my HOMEDRIVE changed...
Any other thoughts before I close it out?
Original:
def GetUserCfgDir(self):
"""
Creates (if required) and returns a filesystem directory for storing
user config files.
"""
cfgDir = '.idlerc'
userDir = os.path.expanduser('~')
if userDir != '~': # expanduser() found user home dir
if not os.path.exists(userDir):
warn = ('\n Warning: os.path.expanduser("~") points to\n '+
userDir+',\n but the path does not exist.\n')
sys.stderr.write(warn)
userDir = '~'
if userDir == "~": # still no path to home!
# traditionally IDLE has defaulted to os.getcwd(), is this adequate?
userDir = os.getcwd()
userDir = os.path.join(userDir, cfgDir)
if not os.path.exists(userDir):
try:
os.mkdir(userDir)
except (OSError, IOError):
warn = ('\n Warning: unable to create user config directory\n'+
userDir+'\n Check path and permissions.\n Exiting!\n\n')
sys.stderr.write(warn)
raise SystemExit
return userDir
New:
def GetUserCfgDir(self):
"""
Creates (if required) and returns a filesystem directory for storing
user config files.
"""
cfgDir = '.idlerc'
userDir = os.getcwd()
#userDir = os.path.expanduser('~')
#if userDir != '~': # expanduser() found user home dir
# if not os.path.exists(userDir):
# warn = ('\n Warning: os.path.expanduser("~") points to\n '+
# userDir+',\n but the path does not exist.\n')
# sys.stderr.write(warn)
# userDir = '~'
#if userDir == "~": # still no path to home!
# # traditionally IDLE has defaulted to os.getcwd(), is this adequate?
# userDir = os.getcwd()
userDir = os.path.join(userDir, cfgDir)
if not os.path.exists(userDir):
try:
os.mkdir(userDir)
except (OSError, IOError):
warn = ('\n Warning: unable to create user config directory\n'+
userDir+'\n Check path and permissions.\n Exiting!\n\n')
sys.stderr.write(warn)
raise SystemExit
return userDir
It works now, but I don't really like it. Essentially everything is remmed out except for the os.getcwd() part. Maybe I should just have my HOMEDRIVE changed...
Any other thoughts before I close it out?
ASKER
Replaced userDir = os.getcwd() with userDir = 'C:\\Documents and Settings\\' + os.getenv('username')
I'm a little happier now.
I'm a little happier now.
ASKER