En Thu, 06 Aug 2009 12:49:30 -0300, IronyOfLife <mydevfor...@gmail.com>
escribió:
On Aug 5, 4:18 pm, "Gabriel Genellina" <gagsl-...@yahoo.com.ar> wrote:
En Tue, 04 Aug 2009 10:15:24 -0300, IronyOfLife <mydevfor...@gmail.com>
escribió:
> On Aug 3, 8:42 pm, "Gabriel Genellina" <gagsl-...@yahoo.com.ar> wrote:
>> En Mon, 03 Aug 2009 11:04:07 -0300, IronyOfLife
<mydevfor...@gmail.com>
>> escribió:
>> > I have installed python 2.6.2 in windows xp professional machine. I
>> > have set the following environment variables -- PYTHONPATH. It
points
>> > to following windows folders: python root folder, the lib folder
and
>> > lib-tk folder.
>> Why? Did you read it somewhere? Usually there is no need to set the
>> PYTHONPATH variable at all; remove it.
> Setting PYTHONPATH environment variables is mentioned in Python docs.
Could you provide a link please? Setting PYTHONPATH should not be
Here are couple of links that discusses setting PYTHONPATH environment
variable.
http://docs.python.org/using/windows.html
Ouch, that document should be reworked and updated!
http://www.daimi.au.dk/~chili/PBI/pythonpath.html
That's mostly obsolete for current versions. Since PEP370 [0] was
implemented, a per-user private directory is already in sys.path now, so
there is no need to play with PYTHONPATH.
I understand your concerns regarding setting of PYTHONPATH while
multiple versions of Python are installed on the same machine. My fix
however does not use PYTHONPATH. The GNUTLS wrapper module for PYTHON
loads the GNUTLS dll's and it was not able to find them. Using FileMon
(win tool) I found out the paths that are scanned and I copied the
dlls to one of such paths. I still do not like this fix. This is a
temporary solution.
Note that this cannot be fixed from inside Python. When you import a
module, the interpreter scans the directories in ITS search path
(sys.path) looking for a matching module. Once the module is found:
- if it is a Python file, it's executed
- if it is an extension module (a .pyd file, in fact a .dll renamed) it's
loaded using LoadLibraryEx (a Windows function), and finally its
initialization routine is executed.
For LoadLibrary to successfully load the module, all its external
references must be resolved. That is, Windows must locate and load all
other DLLs that this module depends on, using its own search strategy [1],
taking into account the PATH environment variable and many other places.
It is at this stage that you get the error: when the gnutls wrapper
attempts to load the gnutls DLL. That search is done by Windows, not by
Python, and PYTHONPATH has nothing to do with it.
Why different results in IIS and appweb? Note that there exist several
search strategies, they depend on the application home directory, the
location of the .exe, whether SetDllDirectory was called or not, whether
the application has a manifest or not, a .local file or not... Hard to
tell with so many variables.
Can you explain maybe with some sample how to set .pth files? Maybe
this will resolve my issue.
Yes, but I don't think this will actually help with your issue.
pth files are described here [2]. Suppose you want to add c:\foo\bar to
sys.path, then write a file whatever.pth containing this single line:
c:\foo\bar
and place it on c:\your_python_installation\lib\site-packages
When the interpreter starts, it will find the .pth file, read it, and add
any directory it finds (that actually exists) to sys.path
Note that another Python installation will use a diferent site-packages
directory and won't find this particular .pth file, so different Python
versions don't interfere.
---
[0] http://python.org/dev/peps/pep-0370/
[1] http://msdn.microsoft.com/en-us/library/ms682586(VS.85).aspx
[2] http://docs.python.org/library/site.html
--
Gabriel Genellina
--
http://mail.python.org/mailman/listinfo/python-list