Thanks simon.

On Jan 20, 8:37 pm, "King Simon-NFHD78" <simon.k...@motorola.com>
wrote:
> > -----Original Message-----
> > From: sqlalchemy@googlegroups.com
> > [mailto:sqlalch...@googlegroups.com] On Behalf Of abhishek
> > Sent: 20 January 2009 14:26
> > To: sqlalchemy
> > Subject: [sqlalchemy] how to use model.py file across
> > different applications
>
> > Hello all,
>
> > I have been using SQL Alchemy for sometime now in a turbo gears
> > project. Recently, i wanted to write a small piece of python code
> > which has to do a few DB operations on the same DB which is used by my
> > TG project. so i decided to use the existing model.py file.
>
> > to my delight, as soon as i imported model.py in my code i was able to
> > use all the functions and classes in my code. but when i tried to
> > execute my code it gave me this error:
>
> > --------------------------------------------------------------
> > --------------------------------------------------------------
> > ------------------------------
> > File "d:\python25\lib\site-packages\SQLAlchemy-0.4.4-py2.5.egg
> > \sqlalchemy\orm\scoping.py", line 98, in do
> >     return getattr(self.registry(), name)(*args, **kwargs)
>
> > File "d:\python25\lib\site-packages\SQLAlchemy-0.4.4-py2.5.egg
> > \sqlalchemy\util.py", line 967, in __call__
> >     return self.registry.setdefault(key, self.createfunc())
>
> > File "d:\python25\lib\site-packages\TurboGears-1.0.4b3-py2.5.egg
> > \turbogears\database.py", line 54, in create_session
> >     get_engine()
>
> > File "d:\python25\lib\site-packages\TurboGears-1.0.4b3-py2.5.egg
> > \turbogears\database.py", line 43, in get_engine
> >     dburi = alch_args.pop('dburi')
>
> > KeyError: 'pop(): dictionary is empty'
>
> > --------------------------------------------------------------
> > --------------------------------------------------------------
> > ------------------------------
>
> > i am using TG2.0, SQLAlchemy0.4.
> > if some one needs any part of code from model.py or some configuration
> > from prod.cfg please feel free to ask.
>
> > Suggestions are urgently required.
>
> > Regards
> > Abhishek
>
> Actually, according to that stack trace, you are using TurboGears
> 1.0.4b3, not 2.0. If you have both versions installed, you may want to
> check that you are really importing what you think you are importing.
>
> The error that you are getting is because you haven't loaded your
> TurboGears config file, which is where the SQLAlchemy database
> connection URI is defined. In TurboGears 1 I think you do that something
> like this:
>
>   import turbogears
>   turbogears.update_config(configfile='prod.cfg',
> modulename='YOUR_APP_NAME.config')
>
> (replace YOUR_APP_NAME with your root-level package name). I don't know
> what the equivalent is in TG2.
>
> Hope that helps,
>
> Simon
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to