bistromath / gr-air-modes

Gnuradio Mode-S/ADS-B radio
This project implements a Mode S receiver for the Gnuradio software-defined radio project. It is designed to receive Mode S transmissions from aircraft and decode them to a human-readable format, including ADS-B information messages such as position and a
GNU General Public License v3.0
447 stars 129 forks source link

KML Output Broken #10

Closed ryannathans closed 12 years ago

ryannathans commented 12 years ago

ryannathans@bender:~/Desktop/rtlsdr/gr-air-modes/gr-air-modes$ uhd_modes.py -d -g 49 --kml=KML -a -l [OBFUSCATED] Traceback (most recent call last): File "/usr/local/bin/uhd_modes.py", line 190, in kmlgen = air_modes.modes_kml(options.kml, my_position) #create a KML generating thread File "/usr/local/lib/python2.7/dist-packages/air_modes/modes_kml.py", line 30, in init modes_output_sql.init(self, localpos, self._dbname) #write to the db File "/usr/local/lib/python2.7/dist-packages/air_modes/modes_sql.py", line 32, in init self.db = sqlite3.connect(filename) sqlite3.OperationalError: unable to open database file Error in sys.excepthook: Traceback (most recent call last): File "/usr/lib/python2.7/dist-packages/apport_python_hook.py", line 68, in apport_excepthook binary = os.path.realpath(os.path.join(os.getcwdu(), sys.argv[0])) OSError: [Errno 2] No such file or directory

Original exception was: Traceback (most recent call last): File "/usr/local/bin/uhd_modes.py", line 190, in kmlgen = air_modes.modes_kml(options.kml, my_position) #create a KML generating thread File "/usr/local/lib/python2.7/dist-packages/air_modes/modes_kml.py", line 30, in init modes_output_sql.init(self, localpos, self._dbname) #write to the db File "/usr/local/lib/python2.7/dist-packages/air_modes/modes_sql.py", line 32, in init self.db = sqlite3.connect(filename) sqlite3.OperationalError: unable to open database file Exception AttributeError: "'modes_kml' object has no attribute 'db'" in <bound method modes_kml.del of <modes_kml(Thread-1, initial)>> ignored

bistromath commented 12 years ago

Ryan,

Can you please try the following patch?

diff --git a/python/modes_sql.py b/python/modes_sql.py
index 88d2033..5ec53a4 100644
--- a/python/modes_sql.py
+++ b/python/modes_sql.py
@@ -54,6 +54,7 @@ class modes_output_sql(modes_parse.modes_parse):
             );"""
     c.execute(query)
     c.close()
+    self.db.commit()

   def __del__(self):
     self.db.close()
ryannathans commented 12 years ago

It no longer crashes on startup.

Let's call it solved.

bistromath commented 12 years ago

patched and closed, thanks for the report!