Cannot launch system-installed hg from local hg repository

K Thananchayan thananck at yahoo.com
Thu Jun 30 10:25:59 UTC 2005


>My findings are that it's not the '' that creates a
problem. Indeed,
>'' refers to the path of the *script*, so it's
correct 99% of the time
>(I am not aware of cases where it shouldn't). The
problem is the
>implicit '.' which gets inserted by
I-don't-understand-who (together
> with a C:\windows\system32\python24.zip on my system
...)

The module search path initialization code for python

constructs initial one as follows (from
PC/getpathp.c):

	/* We need to construct a path from the following
parts.
	   (1) the PYTHONPATH environment variable, if set;
	   (2) for Win32, the zip archive file path;
	   (3) for Win32, the machinepath and userpath, if
set;
	   (4) the PYTHONPATH config macro, with the leading
"."
	       of each component replaced with pythonhome, if
set;
	   (5) the directory containing the executable
(argv0_path).
	   The length calculation calculates #4 first.
	   Extra rules:
	   - If PYTHONHOME is set (in any way) item (3) is
ignored.
	   - If registry values are used, (4) and (5) are
ignored.
	*/

userpath and machinepath areconstructed out of 
Software/Python/PythonCore/<Python Version>/PythonPath
registory key under subtrees HKEY_CURRENT_USER,
HKEY_LOCAL_MACHINE respectively. If such key exists,
the corresponding path is constructed to contain
values of the all keys beneath it. Value of the key is
also appended if python home cannot be deduced by
other means.

In my case, 
HKEY_CURRENT_USER/Software/Python/PythonCore/2.3/PythonPath
exists with zero subkeys and <Python Home> can be
deduced from executabe path, resulting in empty
userpath getting inserted (by what appears to be a
bug) to the module search path. machinepath is null
(key does not exist) and so does not contribute to
module search path. Adding a subkey with nonexistant
directory name as default works around this behaviour.

Hope this helps.

-thanan 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 



More information about the Mercurial mailing list