[capi-sig] Win64 Vim: sys.path not set correctly

Mark Hammond mhammond at skippinet.com.au
Mon Oct 29 22:15:02 CET 2007


> I think I've fixed all the tedious Py_ssize_t issues, and the simple
> sanity test of
>   :py print "hi"
> works. However, more complex examples fall over with ImportErrors. As
> far as I can tell, it's related to sys.path, which shows as:
>   ['', 'd:\\Python25\\python25.zip', '.\\DLLs', '.\\lib',
> '.\\lib\\plat-win', '.\\lib\\lib-tk', 'D:\\vimsrc\\vim7\\src']
> 
> When I run python interactively, sys.path looks like:
>   ['', 'd:\\Python25\\python25.zip', 'd:\\Python25\\DLLs',
> 'd:\\Python25\\lib', 'd:\\Python25\\lib\\plat-win',
> 'd:\\Python25\\lib\\lib-tk', 'd:\\Python25',
> 'd:\\Python25\\lib\\site-packages']
> 
> If I modify sys.path to use the fully qualified pathnames, things
> start working. If I build a 32-bit version of Vim, things work out of
> the box.
> 
> I'm loading python25.dll; i.e., Vim was compiled with
> -DDYNAMIC_PYTHON. The python25.dll was installed by
> python-2.5.1.amd64.msi.

This will be related to the registry entries being written into the 32bit
part of the registry rather than the 64bit version.  As a result, whenever
Python is embedded in another application and needs to use the registry to
locate its installation path, it fails, and uses the fallback relative
values of ".\DLLs", ".\lib" etc.  On the other hand, when Python is started
normally, it can locate its library automatically, so the correct entries
are used.

If you search the python-dev archives, you will see a discussion on this
issue, and also a new copy of the installer put together by Martin V Loewis
to test the fix for this issue.  It is expected that the fix will also
appear in Python 2.5.2.

Hope this helps,

Mark



More information about the capi-sig mailing list