problems with extending and embedding python on win2k

Srivatsan Raghavan vraghavan at cnmnetwork.com
Wed Jul 31 17:26:48 EDT 2002


hello all, i am trying to extend and embed python ..

i've used boost::python v1 to extend an existing C++ library to
python..
and that works out beautifully :) 
from the commandline, or from idle i can import the api fine..
and use it great..
but when i embed calls to the python interpreter, i get ImportError's

to bring this into the realm of the specific : 
Logging.dll is located in : C:\Python22\Libs\site-packages

===script.py
import Logging

def run() : 
     e = Logging.Event()
     print e.str()
===script.py

from the command line, when i do :  python site.py , that works fine, 
and i get some output 

however, when in my app, when i do : 
	
===LogTestApp\main.cpp
  std::string         m_scriptName("C:\\script.py"); 
  fp = fopen ( m_scriptName.c_str() , "r" ) ; 
  PyRun_SimpleFile ( fp , const_cast<char*> (  m_scriptName.c_str( ) 
) ) ;
===LogTestApp\main.cpp

in the console window that pops up i get this error  : 

Traceback (most recent call last):
  File "<string>", line 1, in ?
ImportError: No module named Logging
Traceback (most recent call last):
  File "C:\projects\PythonLogEndPoint\script.py", line 3, in ?
    import Logging
ImportError: No module named Logging

so ,it appears to me that Libs\site-packages\Logging.dll is not being
loaded..

which i can't explain, since i created another file that did nothing
but print sys.path, and C:\Python22\Libs\site-packages *IS* part of
the path ..

so it appears the path is being searched, but for some reason my
extension module is not being loaded..

i am using Microsoft Visual C++ 6.0 : Service Pack 5
on Windows 2000 : Service Pack 2 .. 

--vat
vraghavan at cnmnetwork.com

==.sig==
Evil requires nothing more to win than that good men do nothing.

==.sig==



More information about the Python-list mailing list