Terry J. Reedy added the comment:

.idlerc is a directory that contains the user versions of config-xyz.def. There 
are currently 4, another will probably be added.  The 'offending' code is in 
configHandler.IdleConf.GetUserCfgDir() (line 195).
if not os.path.exists(userDir):
    try:
        os.mkdir(userDir)
    except OSError:
        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

The last line could be replaces by 'return None'.  The calling code that uses 
the normal return would have to be changed to skip trying to read and write the 
config files. According to Ned, Idle already manages if .idlerc exists but is 
unwritable.

The recent files list and breakpoint lists are also stored in .idlerc. Here are 
the 4 hits for 'GetUserCfgDir' in C:\Programs\Python34\Lib\idlelib\*.py ...

EditorWindow.py: 145:         self.recent_files_path = 
os.path.join(idleConf.GetUserCfgDir(),
PyShell.py: 131:         self.breakpointPath = 
os.path.join(idleConf.GetUserCfgDir(),
configHandler.py: 184:         userDir=self.GetUserCfgDir()
configHandler.py: 195:     def GetUserCfgDir(self):

While Idle could continue without any of these, I like Brian's idea of asking 
for an alternative first. Actually, if there is no 'home' directory (if 
expanduser('~') below fails), Idle already tries the current directory as a 
backup. It could do the same if a home directory exits but is unusable.

How far should we go with this? A command-line option to set the user cfg dir?  
That should be doable.

I thought about a new idlelib/config-users.def mapping users to directories, 
but that has its own problems of write permission, as will as cross-platform 
access to user name.

The OP (Bryan) asked "[is] there is a way to hardcode a reference path that 
doesnt point to my "M:\" drive for this directory[?]"  Yes. GetUserCfgDir 
starts with
        cfgDir = '.idlerc'
        userDir = os.path.expanduser('~')
Replace the second line, after each install, to point to a writable directory.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue8231>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to