[SciPy-dev] Python (Enthought Edition) for Windows test release

Fernando Perez Fernando.Perez at colorado.edu
Fri Jan 21 14:15:18 CST 2005

John Hunter wrote:

> FYI, I'm getting an ipython warning error when I use
>   C:\Enthon23\python.exe C:\Enthon23\Scripts\ipython -p enthought 
> WARNING: Program configuration file enthought not found
> Note I did use a non-standard install path.  Where on win32 should the
> enthought config file reside?

 From the manpage:

        -profile|p <name>
               Assume that your config file  is  ipythonrc-<name>  (looks  in
               current dir first, then in IPYTHONDIR). This is a quick way to
               keep and load multiple config files for different tasks, espe-
               cially  if you use the include option of config files. You can
               keep a basic IPYTHONDIR/ipythonrc file  and  then  have  other
               'profiles'  which  include  this one and load extra things for
               particular tasks. For example:

               1) $HOME/.ipython/ipythonrc : load  basic  things  you  always
               2)  $HOME/.ipython/ipythonrc-math  :  load (1) and basic math-
               related modules.
               3) $HOME/.ipython/ipythonrc-numeric : load (1) and Numeric and
               plotting modules.

               Since  it  is  possible  to  create  an endless loop by having
               circular file inclusions, IPython will stop if it  reaches  15
               recursive inclusions.

The code in ipython which tries to answer what 'home' is follows (from 

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

     For Posix systems, this is $HOME, and on NT it's $HOMEDRIVE\$HOMEPATH.

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

     if os.name == 'posix':
         return os.environ['HOME']
     elif os.name == 'nt':
         # For some strange reason, win9x returns 'nt' for os.name.
             return os.path.join(os.environ['HOMEDRIVE'],os.environ['HOMEPATH'])
                 # 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]
                 return homedir
                 return 'C:\\'
     elif os.name == 'dos':
         # Desperate, may do absurd things in classic MacOS. May work under DOS.
         return 'C:\\'
         raise HomeDirError,'support for your operating system not implemented.'

All of this means that under win32, if $HOMEDRIVE\$HOMEPATH is not defined, 
then the registry key 
Folders\Personal is used.  Whether this is a good idea or not, I don't know. 
I putzed around until I got somehting that returned reasonable-looking 
answers, and that was the end of it.  I'm open to suggestions on better 
choices for this.  Under posix, you just get $HOME, and you're done.

Once this is answered, then ipython makes a .ipython/ subdir below this HOME 
directory, and that's where it looks for profiles (which must be named 
ipythonrc-FOO to be recognized by 'ipython -p FOO').  So the enthought profile 
should be a file called 'ipythonrc-enthought', located in HOME/.ipython/. 
FWIW on my friend's system, with a default install, this worked just right.

I hope this helps, and please let me know if you guys need anything else on this.



More information about the Scipy-dev mailing list