[SQLObject] FW: Newbie Problems connecting sqlite
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: Joaquin A. M. <gat...@ho...> - 2009-08-24 11:32:22
|
Hi, I am probably doing something very wrong, but I can not discover what it is. I googled and checked the archives but I did not found any hint. I am new to SQLObject (although experienced in python and databases). I was trying to follow the examples in the documentation but when executing the following code, identical to the one in the examples (except for the name of the database): ********************************* from sqlobject import * import os db_filename = os.path.abspath('data_2.db') if os.path.exists(db_filename): os.unlink(db_filename) connection_string = 'sqlite:' + db_filename connection = connectionForURI(connection_string) sqlhub.processConnection = connection class Person(SQLObject): name = StringCol() Person.createTable() ********************************************************** I get : "AssertionError: URIs must start with scheme:/ -- you did not include a / (in 'C:\\Python25\\programas\\ignasi_06\\data_2.db')" Then I used "connection_string = 'sqlite:/' + db_filename" or"connection_string = 'sqlite:///' + db_filename" but I got in both cases: "sqlite3.OperationalError: unable to open database file" I tried several ways but neither run. Please help, and be nice if i am missing something obvious (as I suspect) In running the new SQLObject 0.11.0 with python 2.5.4 in windows XP. Thanks Joaquin Comparte tu Facebook con tus amigos de Messenger ¡Descubre cómo! _________________________________________________________________ ¿Quieres los nuevos emoticonos en 3D? ¡Descárgatelos gratis! http://www.vivelive.com/emoticonos3d/index2.html |