[Zope] PYTHONPATH issue .. import failing

Jean Jordaan Jean@mosaicsoftware.com
Wed, 23 Aug 2000 12:36:23 +0200


Hi Zopers

When installing the 'jcNTUserFolder' product, I now get a broken
product in the Control Panel, and the following traceback::

  jcNTUserFolder Import Traceback
  Traceback (innermost last):
    File "C:\programs\ZopeDev\lib\python\OFS\Application.py", line 387, in
import_products
      product=__import__(pname, global_dict, global_dict, silly)
    File
"C:\programs\ZopeDev\lib\python\Products\jcNTUserFolder\__init__.py", line
1, in ?
      import NTUserFolder
    File
"C:\programs\ZopeDev\lib\python\Products\jcNTUserFolder\NTUserFolder.py",
line 9, in ?
      import win32net, win32netcon
  ImportError: DLL load failed: The specified procedure could not be found.

My PYTHONPATH is set as follows::

  > echo $PYTHONPATH
  C:\programs\ZopeDev\bin

The importing code in 
'C:\programs\ZopeDev\lib\python\Products\jcNTUserFolder\NTUserFolder.py'
looks like::

  import win32api
  import win32net, win32netcon
  import win32security

The files to be imported seem to be::

  C:\programs\ZopeDev\bin\lib\win32\win32api.pyd
  C:\programs\ZopeDev\bin\lib\win32\win32net.pyd
  C:\programs\ZopeDev\bin\lib\win32\lib\win32con.py

So why is 'win32api' found and the other two not found? 

The Python API ref has: "For instance, if the Python executable 
is found in "/usr/local/bin/python", it will assume that the 
libraries are in "/usr/local/lib/python1.5". (In fact, this 
particular path is also the ``fallback'' location, used when 
no executable file named "python" is found along $PATH.) The 
user can override this behavior by setting the environment 
variable $PYTHONHOME, or insert additional directories in 
front of the standard path by setting $PYTHONPATH. 

The Zope install has no 'lib/pythonN.M' directory -- so along 
what path are imports searched for then?

-- 
Jean Jordaan       --    technical writer    --
Mosaic Software    --    Zope 2.1.6 on WinNT and W2K