In a nutshell, I upgraded all my eggs (in one basket?) and didn't succeed in making an omlette. I merely got scrambled eggs.
I had a working TurboGears/Elixir/PostgreSQL beastie, but now it's broken. When I create a new basic "quickstart" and use the Elixir identity schema from the previously working app, I get either "'NoneType' object has no attribute 'mapper'". After changing "activemapper" to "elixir" in turbogears/database.py (as hinted at in one of these Google groups) I get "'module' object has no attribute 'bind_meta_data'".
In an effort to narrow down the problem even further, I just tried:
$ tg-admin quickstart --elixir /usr/lib/python2.4/site-packages/SQLAlchemy-0.4.0beta5-py2.4.egg/ sqlalchemy/ext/activemapper.py:24: SADeprecationWarning: SessionContext is deprecated. Use scoped_session(). Enter project name: qwert Enter package name [qwert]: Do you need Identity (usernames/passwords) in this project? [no] yes ... cd qwert ./start-qwert.py
and ended up with the same results as previously mentioned.
You should not use SA 0.4 with Elixir because EX does not support SA 0.4 yet. Try to downgrade to SA 0.3.10 (this version is compatible) using the following command:
easy_install -U "SQLAlchemy==0.3.10"
The other option is to drop Elixir and just use SA 0.4...
For your information I just commited a patch to 1.0 branch to make sure the error does not pass unnoticed as it is now happening.
> You should not use SA 0.4 with Elixir because EX does not support SA 0.4 > yet.
For what it's worth Elixir's trunk (and upcoming 0.4 version) does support SA 0.4. I hope to get it out the door before or slightly after SA 0.4 "final" ships.
> > You should not use SA 0.4 with Elixir because EX does not support SA 0.4 > > yet.
> For what it's worth Elixir's trunk (and upcoming 0.4 version) does > support SA 0.4. I hope to get it out the door before or slightly after > SA 0.4 "final" ships.
I think I'll try the downgrade, as going for the latest trunk resulted in: ___________________________________________________________________________ _____
File "/usr/lib/python2.4/site-packages/TurboGears-1.0.3.2-py2.4.egg /turbogears/database.py", line 63, in create_session return sqlalchemy.create_session() AttributeError: 'module' object has no attribute 'create_session' ___________________________________________________________________________ _____
SADeprecationWarning: SessionContext is deprecated. Use scoped_session(). /usr/lib/python2.4/site-packages/SQLAlchemy-0.4.0beta5-py2.4.egg/sqlalchemy /ext/activemapper.py:24:
SADeprecationWarning: SessionContext is deprecated. Use scoped_session(). 11:38:55,523 cherrypy.msg INFO CONFIG: Server parameters: 11:38:55,523 cherrypy.msg INFO CONFIG: server.environment: development 11:38:55,524 cherrypy.msg INFO CONFIG: server.log_to_screen: True 11:38:55,525 cherrypy.msg INFO CONFIG: server.log_file: 11:38:55,525 cherrypy.msg INFO CONFIG: server.log_tracebacks: True 11:38:55,526 cherrypy.msg INFO CONFIG: server.log_request_headers: True 11:38:55,526 cherrypy.msg INFO CONFIG: server.protocol_version: HTTP/1.0 11:38:55,527 cherrypy.msg INFO CONFIG: server.socket_host: 11:38:55,527 cherrypy.msg INFO CONFIG: server.socket_port: 8080 11:38:55,528 cherrypy.msg INFO CONFIG: server.socket_file: 11:38:55,528 cherrypy.msg INFO CONFIG: server.reverse_dns: False 11:38:55,529 cherrypy.msg INFO CONFIG: server.socket_queue_size: 5 11:38:55,529 cherrypy.msg INFO CONFIG: server.thread_pool: 10 /usr/lib/python2.4/site-packages/TurboGears-1.0.3.2-py2.4.egg/turbogears/da tabase.py:51:
SADeprecationWarning: Call to deprecated function connect metadata.connect(_engine) 11:38:55,565 turbogears.visit INFO Visit Tracking starting 11:38:55,582 turbogears.visit INFO Visit filter initialised Unhandled exception in thread started by <bound method Server._start of <cherrypy._cpserver.Server object at 0xb7ce6c6c>> Traceback (most recent call last): File "/usr/lib/python2.4/site-packages/CherryPy-2.2.1-py2.4.egg/cherrypy/_cpserv er.py",
line 78, in _start Engine._start(self) File "/usr/lib/python2.4/site-packages/CherryPy-2.2.1-py2.4.egg/cherrypy/_cpengi ne.py",
line 108, in _start func() File "/usr/lib/python2.4/site-packages/TurboGears-1.0.3.2-py2.4.egg/turbogears/s tartup.py",
line 234, in startTurboGears ext.start_extension() File "/usr/lib/python2.4/site-packages/TurboGears-1.0.3.2-py2.4.egg /turbogears/visit/api.py", line 68, in start_extension create_extension_model() File "/usr/lib/python2.4/site-packages/TurboGears-1.0.3.2-py2.4.egg /turbogears/visit/api.py", line 87, in create_extension_model _manager.create_model() File "/usr/lib/python2.4/site-packages/TurboGears-1.0.3.2-py2.4.egg /turbogears/visit/savisit.py", line 38, in create_model visit_class.mapper.local_table.create(checkfirst=True) File "build/bdist.linux-i686/egg/elixir/entity.py", line 600, in __getattribute__ File "build/bdist.linux-i686/egg/elixir/__init__.py", line 120, in setup_all File "build/bdist.linux-i686/egg/elixir/__init__.py", line 107, in setup_entities File "build/bdist.linux-i686/egg/elixir/entity.py", line 364, in setup_mapper File "build/bdist.linux-i686/egg/elixir/entity.py", line 673, in mapper File "build/bdist.linux-i686/egg/sqlalchemy/ext/activemapper.py", line 26, in __getattr__ File "build/bdist.linux-i686/egg/sqlalchemy/ext/sessioncontext.py", line 24, in get_current File "build/bdist.linux-i686/egg/sqlalchemy/util.py", line 569, in __call__ File "/usr/lib/python2.4/site-packages/TurboGears-1.0.3.2-py2.4.egg /turbogears/database.py", line 63, in create_session return sqlalchemy.create_session() AttributeError: 'module' object has no attribute 'create_session'
Yes, apparently 0.4 sqlachemy moved that symbol, among others (e.g. relation), to the sqlalchemy.orm module.Got around this by modifying sqlalchemy/__init__.py to have: from sqlalchemy.orm import *
Has been working fine for now. Maybe someone should talk about that with the SQAlchemy folks...
> Yes, apparently 0.4 sqlachemy moved that symbol, among others (e.g. > relation), to the sqlalchemy.orm module.Got around this by modifying > sqlalchemy/__init__.py to have: > from sqlalchemy.orm import *
> Has been working fine for now. > Maybe someone should talk about that with the SQAlchemy folks...
I don't think Mike would accept such a change, this namespace change is done on purpose. We definitely don't want to see the whole orm code loaded in the namespace each time we use SA. There is a lot of use cases when only the sql layer is required.
We are working at the moment to make sure TG is SA 0.4 compatible without being SA 0.3.10 incompatible (which means it will be possible for people with older applications to just stay with 0.3.10 as long as they need to port their code).
This cohabitation will be possible because the SA guys created 0.3.10 in such a way that it exposes both the old and the new API.
Thanks. This was already in the SVN, but we are still working on more fixes because other parts of TG are not ready yet. If you are interested in using SA 0.4 with TurboGears I propose you checkout the SVN head from the 1.0 branch and play with it. I'll commit a bunch of fixes this afternoon that should make TG 1.0.x compatible with old SA 0.3.10 based applications but which will also work with the newer API from SA 0.4. SA 0.3.10 will be the minimum requirement, because older versions do not expose the same API as the 0.4 release.
This has a proposed patch to TG 1.0.x for playing nice with Elixir 0.4 and SA 0.4. It depends on some patches to Elixir (already in Elixir's trac): http://trac.turbogears.org/ticket/1483
After considering all the Python Web frameworks out there I finally settled on TurboGears. Its open nature appeals to me and my plans for an interactive site. However, I am a bit confused about the state of TG 1.0, 1.1, 2.0. Where to start?
So, being prepared for things to come, I decided to use TG 1.0.3.2 with SQLAlchemy (and Genshi, MochiKit/Dojo later on, hopefully) and to follow the Rough Docs at http://www.splee.co.uk/2006/10/14/simpleblog-part-1/.
However, after the first little editing of model.py the only thing I get is the following:
> tg-admin sql create
Creating tables at sqlite:///devdata.sqlite Traceback (most recent call last): File "C:\Python25\Scripts\tg-admin-script.py", line 8, in <module> load_entry_point('TurboGears==1.0.3.2', 'console_scripts', 'tg- admin')() File "c:\python25\lib\site-packages\TurboGears-1.0.3.2-py2.5.egg \turbogears\co mmand\base.py", line 389, in main command.run() File "c:\python25\lib\site-packages\TurboGears-1.0.3.2-py2.5.egg \turbogears\co mmand\base.py", line 115, in run sacommand(command, sys.argv) File "<string>", line 5, in sacommand File "c:\python25\lib\site-packages\TurboGears-1.0.3.2-py2.5.egg \turbogears\co mmand\base.py", line 67, in sacreate from turbogears.database import bind_meta_data, metadata ImportError: cannot import name bind_meta_data
What is wrong here? Is it me or TG or SA or something else?
After that, I tried the same in TG 1.0.4b1 and was told that my sqlite was outdated. The TG egg did not update it automatically and I cannot figure out how to do this manually - stupid me. What now?
thanks a lot for your help Andre
PS This is done with Python 2.5 on Windows for the moment.
apm wrote: > After considering all the Python Web frameworks out there I finally > settled on TurboGears. Its open nature appeals to me and my plans for > an interactive site. However, I am a bit confused about the state of > TG 1.0, 1.1, 2.0. Where to start?
I recommend using the current stable version with SQLAlchemy and Kid-, and then migrate your projects to 1.1 (Genshi is very similar to Kid) and 2.0 when there will be stable releases.
> So, being prepared for things to come, I decided to use TG 1.0.3.2 > with SQLAlchemy (and Genshi, MochiKit/Dojo later on, hopefully) and to > follow the Rough Docs at http://www.splee.co.uk/2006/10/14/simpleblog-part-1/.
> However, after the first little editing of model.py the only thing I > get is the following:
Maybe you installed SA 0.4, but TG 1.0.3.2 works only with SA 0.3.x. This will be fixed in TG 1.0.4.
> After that, I tried the same in TG 1.0.4b1 and was told that my sqlite > was outdated. The TG egg did not update it automatically and I cannot > figure out how to do this manually - stupid me. What now?
Actually it is SA asking for an update of sqlite. But that's simple, just type: easy_install pysqlite
> After considering all the Python Web frameworks out there I finally > settled on TurboGears. Its open nature appeals to me and my plans for > an interactive site. However, I am a bit confused about the state of > TG 1.0, 1.1, 2.0. Where to start?
> So, being prepared for things to come, I decided to use TG 1.0.3.2 > with SQLAlchemy (and Genshi, MochiKit/Dojo later on, hopefully) and to > follow the Rough Docs at http://www.splee.co.uk/2006/10/14/simpleblog-part-1/.
> However, after the first little editing of model.py the only thing I > get is the following:
>> tg-admin sql create
Just getting going with tb, and fell over some of this too.
When you start the project use -s: tg-admin quickstart -s
In dev.cfg in your project folder you need to have something along these lines: sqlalchemy.dburi="firebird://user:password@localhost:3050/C:/dir/project/tb test.fdb"
> apm wrote: > > After considering all the Python Web frameworks out there I finally > > settled on TurboGears. Its open nature appeals to me and my plans for > > an interactive site. However, I am a bit confused about the state of > > TG 1.0, 1.1, 2.0. Where to start?
> I recommend using the current stable version with SQLAlchemy and Kid-, > and then migrate your projects to 1.1 (Genshi is very similar to Kid) > and 2.0 when there will be stable releases.
> > So, being prepared for things to come, I decided to use TG 1.0.3.2 > > with SQLAlchemy (and Genshi, MochiKit/Dojo later on, hopefully) and to > > follow the Rough Docs athttp://www.splee.co.uk/2006/10/14/simpleblog-part-1/.
> > However, after the first little editing of model.py the only thing I > > get is the following:
> Maybe you installed SA 0.4, but TG 1.0.3.2 works only with SA 0.3.x. > This will be fixed in TG 1.0.4.
> > After that, I tried the same in TG 1.0.4b1 and was told that my sqlite > > was outdated. The TG egg did not update it automatically and I cannot > > figure out how to do this manually - stupid me. What now?
> Actually it is SA asking for an update of sqlite. But that's simple, > just type: easy_install pysqlite