IDLE 1.0 on Windows

Andrew Gregory andrew.gregory at npl.co.uk
Wed Oct 15 10:39:28 EDT 2003


IDLE puts its configuration info. in a directory called .idlerc
On running it looks for this directory on a path given by the HOME
environment variable.

On Windows HOME would only exist if the user has created it. If it is
not there, IDLE defaults to the highest-lettered hard drive. This
often will be a network drive and is not a good choice. If the drive
is read only (which is quite possible) IDLE fails.

Here are a few extra lines to go in configHandler.h function
GetUserCfgDir to solve this. This allows an IDLERC environment
variable to be used.

    def GetUserCfgDir(self):
        """
        Creates (if required) and returns a filesystem directory for
storing
        user config files.
        """
        cfgDir='.idlerc'
        if string.find(os.environ['os'].upper(),'WIN')>-1:  
            userDir=os.getenv('IDLERC')
            if userDir==None: userDir=os.getenv('HOME')  # may omit,
given later
            if userDir==None: userDir="C:\\Python23"
            if not os.path.exists(userDir): useDir=os.getcwd()
        else:
            userDir=os.path.expanduser('~')    # unix

[snip]

Andrew.




More information about the Python-list mailing list