views:

25

answers:

1

I'm trying to convert a SQLite 2 file to SQLite3 using Python on Windows. On Linux, I'd just pipe a dump from sqlite to sqlite3:

os.system("sqlite db.sqlite .dump | sqlite3 db3.sqlite")

On Windows, I have no such convenient means of transferring the dump. Here's what I'm doing:

sqlite_dump = os.popen('sqlite %s .dump' % sqlite_db).read()

open(sqlite_dump_file, "w").write(sqlite_dump)

os.system("del %s" % sqlite_db)
os.system("sqlite3 -init %s %s" % (sqlite_db,
                             sqlite_dump_file))

This works, but it leaves me at a sqlite3 prompt. I've tried the -bail switch and added `"\n.quit\n" to the end of the SQLite dump, but to no avail.

What can I do?

+2  A: 

Why can't you pipe it similarly on Windows? What goes wrong when you do it?

John Machin
Honestly? I had no idea you could do that on Windows, so I didn't even try.
JasonFruit