The essence of my problem is this:
I am developing code in Windows XP in C with MS Visual Studio 10.0, and I need to embed Python to plot, manage files and some other things. I had problems with sys.path, which found my Pure-Python modules, but I fixed the problem by changing PYTHONPATH.
Now my problem is getting python to search for dynamic libraries that are pulled by some modules. In particular, my problem is to compress the folder into one bzip2 name with the same name.
From a regular python command line, this works fine:
import tarfile tar=tarfile.open('Code.tar.bz2','w:bz2') tar.add('Code',arcname='Code') tar.close()
But when I call this code from my c-code, it gives me this error:
Traceback (most recent call last): File "<string>", line 4, in <module> File "D:\My_Documents\Code\ScrollModel\trunk\PythonCode.py", line 20, in Colle ctFiles tar=tarfile.open(os.path.join(runPath,'CODE.tar.bz2'),'w:bz2') File "c:\Python26\lib\tarfile.py", line 1671, in open return func(name, filemode, fileobj, **kwargs) File "c:\Python26\lib\tarfile.py", line 1737, in bz2open raise CompressionError("bz2 module is not available") tarfile.CompressionError: bz2 module is not available
I have a suspicion that the problem is similar to that described in section 5.6 Embedded Python , but it is a little difficult to say. What is it worth if I do
Py_Initialize(); PyRun_SimpleString("import ssl\n"); Py_Finalize();
it doesn't work either, and I get ImportError.
Has anyone had a problem? Did I miss something important?