I just noticed that I cannot use the Python 2.6 dll anymore. Python 2.5 works just fine.
import ctypes
py1 = ctypes.cdll.python25
py2 = ctypes.cdll.python26
# ctypes.cdll.LoadLibrary("libpython2.6.so") in linux
py1.Py_Initialize()
py2.Py_Initialize()
# segmentation fault in Linux
py1.PyRun_SimpleString("print 'hello world'")
# this works because it is using python 2.5
py2.PyRun_SimpleString("print 'hello world2'")
# WindowsError: exception: access violation reading 0x00000004
Am I doing anything wrong or is Python 2.6 broken?
Update
- Tried this with the Python 2.7 alpha dll and it appears to work, so it may be a 2.6 problem.
- Tried this on Ubuntu x64 with Python 2.7 alpha and it worked without a segmentation fault.