Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#31 closed defect (fixed)

First run of a Vespa app fails on Ubuntu 10.x w/Python 2.6

Reported by: flip Owned by:
Priority: major Milestone:
Component: common Version:
Keywords: Cc: dtodd


David found this interesting bug. One can install Vespa on Ubuntu 10.x w/Python 2.6, but the first time one runs an app, Vespa will attempt to create its database and will fail. The error is (more or less):

  File "/home/dtodd/dev/vespa/rfpulse/src/", line 334, in <module>
    app, db_filename = util_init.init_app("RFPulse")

  File "/home/dtodd/dev/vespa/common/util/", line 164, in init_app
    create_database.create_database(db_path, logger)

  File "/home/dtodd/dev/vespa/common/", line 71, in create_database

  File "/home/dtodd/dev/vespa/common/util/", line 382, in execute_script_from_file
    self.executescript(open(filename, "r").read())

ProgrammingError: you did not provide a complete SQL statement

The file that executescript is trying to execute is create_views.sql. As of Vespa 0.2.2, that file contains only a comment. The SQL parser probably strips out the comment and whitespace and so the SQL engine sees only a blank statement. I can kinda see why it complains about that.

However, it annoying that this used to work and is now broken. Furthermore, it seems specific to the Python 2.6 shipped with Ubuntu 10. I tested various systems using this command:

python -c 'import sqlite3; print sqlite3.sqlite_version_info; c=sqlite3.Connection(":memory:"); c.executescript("")'

The following combinations accept that:

OS X 10.6                sqlite 3.6.11,   Python 2.6.6
OpenSUSE 11.2            sqlite 3.6.16,   ???
Ubuntu 09.10             sqlite 3.6.16,   ???
RHEL6 Beta               sqlite 3.6.19,   Python 2.6.6 (EPD)
Scientific Linux 6.0     sqlite 3.6.20,   Python 2.6.6
Fedora 14                sqlite, Python 2.7
Fedora 15                sqlite 3.7.5,    Python 2.7.1
Ubuntu 10.10             sqlite 3.7.2,    Python 2.7.0+

The following combinations fail with the sqlite3.ProgrammingError:

Ubuntu 10.04             sqlite 3.6.22,   Python 2.6.5
Ubuntu 10.10             sqlite 3.7.2,    Python 2.6.6

Note that I have Python 2.6 & 2.7 on Ubuntu 10.10 using the same sqlite version. The latter works, the former doesn't.

The workaround is easy -- just add a semicolon to the end of create_views.sql, which gives it a single no-op statement and the parser is happy.

If I can recreate this bug under Ubuntu 11 w/Py2.6 and I have time, I'll file a bug with the Ubuntu community.

Change History (3)

comment:1 Changed 9 years ago by flip

  • Resolution set to fixed
  • Status changed from new to closed

Fixed in r2590.

comment:2 Changed 9 years ago by flip

Confirmed on Ubuntu 11.04. Python 2.6 raises sqlite3.ProgrammingError, Python 2.7 does not.

Note: See TracTickets for help on using tickets.