application error in python

Jason tenax.raccoon at gmail.com
Wed Jan 23 12:11:58 EST 2008


On Jan 23, 4:29 am, abhishek <guptaabhishek1... at gmail.com> wrote:
> hello group i am working on a project where most of the code has been
> written in c++ but the web component is written in python. Initially
> we have been using python2.4 and vs.net2003 but recently we decided to
> move ahead with python2.5 and vs.net2005.
>
> the problem that has been haunting me for while now is when i am
> trying to access a few functions in c++ through python by
> building .pyd extension, python.exe crashes saying an application
> error has occured
>
> any clues why this happened as everythiing was working well
> in .net2003 and python2.4
>
> thanks abhishek

It could be that Python 2.5 is still built and linked against version
7.1 of the Microsoft C run-time.  VS 2005 links against version 8.0 of
the Microsoft C run-time.  The two versions of the DLL are
incompatible, and will cause crashes if memory is allocated from one
DLL and then freed with the other.  File handles also opened with one
C run-time DLL cannot be used with the other version either.

Unfortunately, there's no really good fix for this.  Microsoft made
their libraries and C run-time incompatible between versions of Visual
Studio.  Rather than force all Python developers to switch to VS 2005,
the Python core developers stayed with the previous compiler.

If you absolutely must be able to pass file handles and memory with VS
2005 DLLs, you must recompile Python with VS 2005.  You will also need
to recompile all DLL libraries, such as wxPython, LXML, and the PIL.
Pure Python modules and libraries will be unaffected.

The easiest solution, however, is to use Python 2.5 and Visual Studio
2003.

  --Jason



More information about the Python-list mailing list