[IPython-user] Re[2]: IPython not reloading file under Win2000

Fernando Perez Fernando.Perez at colorado.edu
Thu Jul 14 11:19:18 CDT 2005


Alan G Isaac wrote:

>>What version of ipython and what version of python are you 
>>using?  There is a bug in the inspect module (part of 
>>python) which can cause this.  I've personally never seen 
>>such behavior with current versions. 
> 
> 
> 
> I had:
> Python 2.3.3 (#51, Dec 18 2003, 20:22:39) [MSC v.1200 32 bit (Intel)]
> IPython 0.6.2 -- An enhanced Interactive Python.

Certainly way too old.

> OK, so I downloaded the recent version and tried installing 
> it.  It tried using %USERPROFILE% oddly in the path to store 
> a .ini file, but this produced literally
> 'C:\Documents and Settings\aisaac\My Documents\%USERPROFILE%\_ipython'
> So there is an installation bug under Win2000.
> (I should note that I have seen other applications have
> problems with %USERPROFILE% under Win2000; I believe John
> had to fiddle with this for font caching.)

Well, the installer doesn't read USERPROFILE directly, this is the routine 
involved:

def get_home_dir():
     """Return the closest possible equivalent to a 'home' directory.

     We first try $HOME.  Absent that, on NT it's $HOMEDRIVE\$HOMEPATH.

     Currently only Posix and NT are implemented, a HomeDirError exception is
     raised for all other OSes. """

     try:
         return os.environ['HOME']
     except KeyError:
         if os.name == 'posix':
             raise HomeDirError,'undefined $HOME, IPython can not proceed.'
         elif os.name == 'nt':
             # For some strange reason, win9x returns 'nt' for os.name.
             try:
                 return 
os.path.join(os.environ['HOMEDRIVE'],os.environ['HOMEPATH'])
             except:
                 try:
                     # Use the registry to get the 'My Documents' folder.
                     import _winreg as wreg
                     key = wreg.OpenKey(wreg.HKEY_CURRENT_USER,
 
"Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders")
                     homedir = wreg.QueryValueEx(key,'Personal')[0]
                     key.Close()
                     return homedir
                 except:
                     return 'C:\\'
         elif os.name == 'dos':
             # Desperate, may do absurd things in classic MacOS. May work 
under DOS.
             return 'C:\\'
         else:
             raise HomeDirError,'support for your operating system not 
implemented.'


I know other users are successfully using ipython under win2k, so I doubt it's 
a win2k-specific problem.  I'm more inclined to think that there's something a 
bit different about your setup which is confusing the above routine.

> Now I no longer have the problem I reported, which you 
> attributed to the inspect module, but I have lost the nice 
> highlighting I had before---presumably because I have no 
> *.ini file and so have lost all runtime configurations.

Do you have current readline and ctypes as per this?

http://ipython.scipy.org/doc/manual/node2.html#SECTION00023000000000000000

If you do, you could try to simply execute the above routine in a python 
shell, to see what it gives for your system (it's in IPython.genutils).  Based 
on that, ipython stores all its config in a subdir called .ipython/, below 
whatever get_home_dir() returns.

I hope this helps,

f




More information about the IPython-user mailing list