Re: psycopg2 and Python 2.6a1
Patrick Hartling <[email protected]>
| Newsgroups | gmane.comp.python.db.psycopg.devel |
|---|---|
| Message-ID | <[email protected]> |
On Mar 4, 2008, at 11:27 AM, Jason Erickson wrote: > On Tue, 4 Mar 2008, Patrick Hartling wrote: > >> I am evaluating the use of Python 2.6 as the foundation for our >> software, and I am running into a crash with psycopg2 on Windows. >> For some reason, I have been unable to get Visual Studio to show me >> any debugging details in the stack trace for the code in >> _psycopg2.pyd, and I was hoping that someone here might have some >> tips. >> >> In my efforts to track this down, I have tried several things. At >> the moment, I am running a release build of the Python interpreter >> that I built myself so that I could get the vc90.pdb file for the >> interpreter. I have no problems tracing through code in the Pyhton >> interpreter, but I have not been able to get _psycopg2.pyd to build >> in such a way that the debugger can extract any information from >> it. I have built psycopg2 source from the 2_0_x SVN branch as a >> release binary with modifications to C:\Python26\Lib\distutils >> \msvc9compiler.py so that /Z7 and /Od are used when building >> extension modules linked against the MSVC release runtime. This is >> what I would prefer to do since, IIUC, the debugging symbols are >> built into the binary. Normally, this approach works for me without >> problems, though this is the first time that I have tried to debug >> a Python extension module on Windows that I did not write myself. I >> also tried building psycopg2 using /Zi and /Od to make a specific >> PDB file for _psycopg2.pyd, but the debugger never finds it no >> matter where I put it. >> >> In case it helps, I have attached the stack trace that I do get. >> Any guidance would be greatly appreciated. >> >> -Patrick > > Patrick, > > I have built psycopg with debugging symbols successfully on the > windows platform. My build environment is at home, so what follows > is from memory... > > When I compiled debug symbol builds, I did not change any distutils > files. The catch is that I used the debug version of python > (python_d), and I built the pyscopg with the --debug switch. Ahh, I > see from the stack trace that you have several other files being > imported, too, which explains why you are using the release version > of python. You would need 'debug' builds of those files, too. That > makes this method more challenging :) Indeed. I did try building against the debug runtime and using python_d, but simply trying to import psycopg2 failed due to an "invalid memory access" error. I did not try tracking that down because it seemed like building against the release runtime with debug symbols would be easier to handle in general. > After pondering some more, I remember having a similar situation. I > ended up creating a VS project to compile psycopg with the debug > symbols, yet link against the release version of python. When doing > this, I had to do the following: Setup the include and library > directories, add the libraries that it links against, setup the > defines that are located at the top of the setup.cfg file, set the > name for the 'dll' correctly, and include all the 'c' files. > > I do not recall if I tried modifing the distutils code or not for > this situation. I have modified distutils for various reasons in > the past with mixed results, and I can not remember if this was one > of those time, or if it was successful. My experience has been hit > and miss with making changes with distutils, but I'm sure that is > 'operator error' more than anything else. > > If you would like, I can look and see if I still have the VS file > (VS 2003 since it was built for use with Python 2.5), and send it to > you later on tonight. You would have to change the paths to your > file structure layout, but I believe that is about it. Thanks for the tips. If you do still have that project file, it would be helpful. -Patrick -- Patrick L. Hartling Senior Software Engineer, Priority 5 http://www.priority5.com/ _______________________________________________ Psycopg mailing list Psycopg-IAPFreCvJWPBWskQ1e/[email protected] http://lists.initd.org/mailman/listinfo/psycopg
PGP.sig
(application/pgp-signature, 186 B) - not displayed