H
Henrik
Hi,
We are upgrading from Python 2.3 to verion 2.5 and when we recompile
we get ImportError.
To test we took the spam example from the web documentation and
compiled it with Py23 and it imports without a problem. Changing the
libs in visual studio 2008 to point to Py25 and we get:
Traceback (most recent call last):
Would really appreciate any assistance.
H
----------------------------------------------------------------------------------------------------------------------
#include "stdafx.h"
#ifdef _MANAGED
#pragma managed(push, off)
#endif
BOOL APIENTRY DllMain( HMODULE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
return TRUE;
}
#ifdef _MANAGED
#pragma managed(pop)
#endif
static PyObject *
spam_system(PyObject *self, PyObject *args)
{
const char *command;
int sts;
if (!PyArg_ParseTuple(args, "s", &command))
return NULL;
sts = system(command);
return Py_BuildValue("i", sts);
}
static PyMethodDef PyBSMethods[] = {
{"spam", (PyCFunction) spam_system, METH_VARARGS|METH_KEYWORDS,
"Hi"},
{NULL, NULL, 0, NULL} /* Sentinel */
};
extern "C" {
__declspec(dllexport) void initspam(void)
{
PyObject* module = Py_InitModule("spam", PyBSMethods);
PyObject* d = PyModule_GetDict(module);
}
}
----------------------------------------------------------------------------------------------------------------------
We are upgrading from Python 2.3 to verion 2.5 and when we recompile
we get ImportError.
To test we took the spam example from the web documentation and
compiled it with Py23 and it imports without a problem. Changing the
libs in visual studio 2008 to point to Py25 and we get:
Traceback (most recent call last):
Would really appreciate any assistance.
H
----------------------------------------------------------------------------------------------------------------------
#include "stdafx.h"
#ifdef _MANAGED
#pragma managed(push, off)
#endif
BOOL APIENTRY DllMain( HMODULE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
return TRUE;
}
#ifdef _MANAGED
#pragma managed(pop)
#endif
static PyObject *
spam_system(PyObject *self, PyObject *args)
{
const char *command;
int sts;
if (!PyArg_ParseTuple(args, "s", &command))
return NULL;
sts = system(command);
return Py_BuildValue("i", sts);
}
static PyMethodDef PyBSMethods[] = {
{"spam", (PyCFunction) spam_system, METH_VARARGS|METH_KEYWORDS,
"Hi"},
{NULL, NULL, 0, NULL} /* Sentinel */
};
extern "C" {
__declspec(dllexport) void initspam(void)
{
PyObject* module = Py_InitModule("spam", PyBSMethods);
PyObject* d = PyModule_GetDict(module);
}
}
----------------------------------------------------------------------------------------------------------------------