pysqlite throwing exception?
MRAB
python at mrabarnett.plus.com
Sat Sep 5 17:11:16 EDT 2009
william tanksley wrote:
> I'm trying to modify an app I wrote a few months ago, but now it dies
> on startup (it worked before). The app loads the SQLite Media Monkey
> database, and crashes on its first query (when I try to get the number
> of podcasts). At the end of this post is a reduced version of the
> problem (which produces the same error).
>
> Oh, this is Python 2.5 on Windows.
>
> The following is the traceback for the reduced version:
>
> Traceback (most recent call last):
> File "C:\projects\podcasts\podstrand-mm\temp.py", line 16, in
> <module>
> cursor.execute("select count(*) as count from songs")
> OperationalError: malformed database schema - near "VIRTUAL": syntax
> error
>
> It's the same error I get while running this code in context.
>
> The major change is that I upgraded version of MediaMonkey, and I'd
> think that might cause problems-- although all of my non-Python SQLite
> support apps have no problem (including running the same query).
>
> Unfortunately, if pysqlite's been upgraded, I can't find it --
> pysqlite.org has been down the past 2 days.
>
> -Wm
> ------------
>
> import os
> import sqlite3
>
> # Find the mediamonkey database.
> conn = sqlite3.connect(
> os.path.join(os.environ['USERPROFILE'],
> 'Local Settings',
> 'Application Data',
> 'MediaMonkey',
> 'MM.DB')
> )
> conn.row_factory = sqlite3.Row # provide named columns in results
> # Ask mediamonkey for its data.
> cursor = conn.cursor()
> # Get the total number of songs.
> cursor.execute("select count(*) as count from songs")
> track_estimate = cursor.fetchall()[0]['count']
>
I wonder whether it's complaining about the "as count" part because
"count" is the name of a function, although you do say that the same
query works elsewhere.
More information about the Python-list
mailing list