[pysqlite] Seg Fault Only When Table Contains Data
Rich Shepard <[email protected]> Mon, 2 Jun 2008 18:00:24 -0700 (PDT)
| Newsgroups | gmane.comp.python.db.pysqlite.user |
|---|---|
| Message-ID | <[email protected]> |
I could use some independent ideas to help me solve this problem. It
follows on this past weekend's thread on writing a variable number of fields
to a SQLite table.
Having solved that problem, I loaded the initial columns in the wxPython
grid widget and saved them to the table. (The save method was presented in
my last message on that thread.) But, this morning when I invoked the
application after adding more functionality, it bombed with a segmentation
fault as soon as I selected the project data file to open. Running strace
(and gdb on the core dump) gave me no insight into the source of the
problem. Howevever, by commenting out code in various modules and trying to
run the application within winpdb I can identify where the application
crashes, but not why it does.
There is a module, dbMethods.py, that selects records from the SQLite
tables and transfers them to lists for quick access by various other modules
in the application. One section of the OpenDB() method is:
# existing conditions and alternatives data
self.appData.cur.execute("SELECT * from Data")
self.appData.altData = self.appData.cur.fetchall()
If I comment out either (or both) of these two lines, the application opens
and loads normally; no seg fault. But, I can get an error about a
zero-length list when only the SELECT statement is missing.
I also use the Publisher() methods to pass messages among modules. This
method has the line:
Publisher().sendMessage(self.appData.projOpen, data=None)
If I comment that out, no seg fault; with it in, the app crashes.
The dataPage.py module (with the grid widget) has an analogous directive:
Publisher().subscribe(self.loadData, self.appData.projOpen)
Again, if I comment out that line there's no seg fault.
The data in the SQLite table look OK to me; e.g.,
sqlite> select * from Data limit 10;
Aesthetics||AmbientLight||||||||||||||||||||||||||||||
Aesthetics||Viewsheds||||||||||||||||||||||||||||||
AirQuality|FugitiveDust|Levels||||||||||||||||||||||||||||||
AirQuality|FugitiveDust|Persistence||||||||||||||||||||||||||||||
AirQuality|FugitiveDust|SpecialConsiderations||||||||||||||||||||||||||||||
AirQuality|FugitiveDust|Timing||||||||||||||||||||||||||||||
AirQuality|Particulates|Amount||||||||||||||||||||||||||||||
AirQuality|Particulates|HealthEffects||||||||||||||||||||||||||||||
AirQuality|RegionalHaze|DegreeAffected||||||||||||||||||||||||||||||
CulturalHeritage||Quantity||||||||||||||||||||||||||||||
If I 'DELETE from Data' so the table's empty, the application runs. I can
then initialize that table and save the results. But, then it seg faults
when I try to run it again.
I'm completely stumped here; have no idea what's going on or why. Any
thoughts you might have are more than welcome!
Rich
--
Richard B. Shepard, Ph.D. | Integrity Credibility
Applied Ecosystem Services, Inc. | Innovation
<http://www.appl-ecosys.com> Voice: 503-667-4517 Fax: 503-667-8863