Author terry.reedy
Recipients asvetlov, brian.curtin, cane, ned.deily, roger.serwy, terry.reedy
Date 2014-07-10.19:43:56
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1405021437.57.0.122089240979.issue8231@psf.upfronthosting.co.za>
In-reply-to
Content
.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.
History
Date User Action Args
2014-07-10 19:43:57terry.reedysetrecipients: + terry.reedy, ned.deily, roger.serwy, brian.curtin, asvetlov, cane
2014-07-10 19:43:57terry.reedysetmessageid: <1405021437.57.0.122089240979.issue8231@psf.upfronthosting.co.za>
2014-07-10 19:43:57terry.reedylinkissue8231 messages
2014-07-10 19:43:56terry.reedycreate