Re: [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 12:05:31
|
Thanks, it worked.I had tried with "sqlite:/C|/full/path/to/database"as indicated in the documentation but it did not work.J. > Date: Mon, 24 Aug 2009 13:37:59 +0200 > From: jon...@fa... > To: gat...@ho... > CC: sql...@li... > Subject: Re: [SQLObject] FW: Newbie Problems connecting sqlite > > Joaquin Abian Monux escribió: > > 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): > > Recently I used that snippet to connect to a database in ./data/aci.sqlite > > import os > > if os.name == 'nt': > dsn = 'sqlite:/' + os.path.abspath('./data/aci.sqlite') > dsn = dsn.replace(":\\", "|\\") > elif os.name == 'posix': > dsn = 'sqlite://' + os.path.abspath(os.path.join('data', > 'aci.sqlite')) > > > > > jonhattan > > > > ********************************* > > 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! > > <http://www.vivelive.com/feedfacebook/> > > ------------------------------------------------------------------------ > > ¿Quieres los nuevos emoticonos en 3D? ¡Descárgatelos gratis! > > <http://www.vivelive.com/emoticonos3d/index2.html> > > ------------------------------------------------------------------------ > > > > ------------------------------------------------------------------------------ > > Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day > > trial. Simplify your report design, integration and deployment - and focus on > > what you do best, core application coding. Discover what's new with > > Crystal Reports now. http://p.sf.net/sfu/bobj-july > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > sqlobject-discuss mailing list > > sql...@li... > > https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss > > > _________________________________________________________________ Toda la información meteorológica. Consulta en MSN el tiempo que va a hacer en cualquier lugar de España o del Mundo. http://eltiempo.es.msn.com/ |