En Wed, 05 May 2010 09:04:06 -0300, moerchendiser2k3 <googler.1.webmas...@spamgourmet.com> escribió:

I have a serious problem with Python. I am currently trying to
implement Python into my app.
Well this works fine, but get this:

I have my own Python interpreter in a subfolder of my app. When I
start my app, PYTHONHOME is set, and an environment variable is set to
it can find the python DLL on startup.

You should not define any environment variables.

You are embedding Python into your application, aren't you? That is, you call Py_Initialize and all that stuff - you don't invoke a separate python.exe, true?

Python tries to find its standard library looking for
[the directory containing the executable]\Lib\os.py
and a few other places. Once it finds the "Lib" directory, all other are derived from it.

When Python is not installed on the system everything works fine as
expected.

When I now install Python on my system (so I have two python libs now)
the system installation is the preferred one.

print sys.path prints out ['', 'C:\Windows
\system32\python26.zip', ...] and I cant explain whats going wrong
here.

Such zip file doesn't even exist in a standard Python installation; but it means that your program loaded python26.dll from the system32 directory, not your own copy. You may want to use a .local file or a manifest; see
http://msdn.microsoft.com/en-us/library/ms811694.aspx

I expected that it just uses the System lib when it cannot find
it in the subfolder which I set in the environment variables
before.. :-(

Note that this is a Windows issue, not a Python one. You have to ensure the Python DLL is loaded from your own directory, not the system one.

(BTW, don't set any environment variables. There is no need to do so, and it may conflict with an existing installation. The reverse is true too: a PYTHONPATH variable set for the "system" Python will interfere with your private copy too. Global state is always a bad idea.)

--
Gabriel Genellina

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to