pysqlite throwing exception?

  • Thread starter william tanksley
  • Start date
W

william tanksley

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']
 
M

MRAB

william said:
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.
 
W

william tanksley

william tanksley said:
Oh, this is Python 2.5 on Windows.

New result: this works on Python 2.6. Obviously the SQLite format
changed between the two runs.

I'll call this "problem solved"; my app appears to run now.

-Wm
 
W

william tanksley

MRAB said:
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.

Hey, good catch. Thanks; I'll change that. (It wasn't the problem, but
no doubt someday it could be.)

-Wm
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,969
Messages
2,570,161
Members
46,709
Latest member
AustinMudi

Latest Threads

Top