[Python-Dev] Embedded python on Win2K, import failures

Harri Pasanen harri@labs.trema.com
Fri, 11 Apr 2003 14:16:47 +0200


Hello,

In a few hours old CVS checkout, I'm having problems getting the 
embedded python to work.

---------8<------------8<-------------8<-------------8<-----------------
#include <Python.h>

char* cmd = "import sys; print sys.path\n"
"import re; print dir(re)\n";

int main()
{
	Py_Initialize();
	printf("Initialize done\n");
	PyRun_SimpleString(cmd);
	Py_Finalize();

	return 0;
}
---------8<------------8<-------------8<-------------8<-----------------

import re seems to be succeeded only half way, the output is:

Initialize done
['f:\\trema\\fk-dev\\tools\\python\\PCbuild\\python23.zip', 
'f:\\trema\\fk-dev\\tools\\python\\DLLs', 
'f:\\trema\\fk-dev\\tools\\python\\lib', 
'f:\\trema\\fk-dev\\tools\\python\\lib\\plat-win', 
'f:\\trema\\fk-dev\\tools\\python\\lib\\lib-tk', 
'f:\\trema\\fk-dev\\tools\\python\\Demo\\embed', 
'f:\\trema\\fk-dev\\tools\\python', 
'f:\\trema\\fk-dev\\tools\\python\\lib\\site-packages']
['__builtins__', '__doc__', '__file__', '__name__', 'engine']


So the re namespace is lacking everything from sre.

On linux it works both embedded, and from the interactive interpreter.  
On Win2K the interactive interpreter seems to work fine.

On Win2K, I have this working ok using Python 2.2.2.

What gives?


Harri