Mimicing intepreter import behaviour in embedded application

Syver Enstad syver-en+usenet at online.no
Sun Sep 8 18:45:19 CEST 2002


I have embedded python in a C++ application. Now I want python code running
in this application to reach modules in the same way as code running
in the standard interpreter. So I set up a test comparing the sys.path
variable under python and my application with the intpreter embedded.

Most of the two sys.path's are equal except:
Regular python:                   Embedded:
 ('d:\\devtools\\python22\\DLLs', 'D:\\devtools\\Python22\\Lib'),
 ('d:\\devtools\\python22\\lib', 'D:\\devtools\\Python22\\DLLs'),
 ('d:\\devtools\\python22\\lib\\lib-tk',
  'D:\\devtools\\Python22\\Lib\\lib-tk'),
This line is caused by the differing locations of the .exe files
 ('d:\\devtools\\python22', 'h:\\mydocuments\\Kode\\C++\\Applications\\pyexe'),
 ('d:\\devtools\\python22\\lib\\site-packages\\Numeric',
  'D:\\devtools\\Python22'),
Here I miss the .pth file that I have for PIL.
 ('d:\\devtools\\python22\\lib\\site-packages\\PIL',
  'D:\\devtools\\Python22\\lib\\site-packages\\Numeric')]

Is there a way to more closely mimic "the real interpreter"?


-- 

Vennlig hilsen 

Syver Enstad



More information about the Python-list mailing list