Rotten .egg's. ;-)

6 views
Skip to first unread message

Kevin Cole

unread,
Sep 7, 2007, 1:43:46 PM9/7/07
to turbo...@googlegroups.com, eli...@googlegroups.com
Hi,  I was trying to get help on IRC, and pasted my query and problem into the pastebin:

http://paste.turbogears.org/paste/1604

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'".

Thanks for any help.

--
Ubuntu Linux DC LoCo
Washington, DC
http://dc.ubuntu-us.org/

Kevin Cole

unread,
Sep 7, 2007, 4:19:22 PM9/7/07
to SQLElixir, turbo...@googlegroups.com
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.

Florent Aide

unread,
Sep 7, 2007, 5:47:57 PM9/7/07
to turbo...@googlegroups.com
Kevin Cole a écrit :

> 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/
>
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.

Florent.

Gaetan de Menten

unread,
Sep 8, 2007, 3:11:13 AM9/8/07
to turbo...@googlegroups.com
On 9/7/07, Florent Aide <floren...@gmail.com> wrote:
>
> Kevin Cole a écrit :
> > 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/
> >
> 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.

--
Gaëtan de Menten
http://openhex.org

Elvelind Grandin

unread,
Sep 8, 2007, 3:42:09 AM9/8/07
to turbo...@googlegroups.com
which means that you can just run

easy_install http://elixir.ematia.de/svn/elixir/trunk/
to get the latest trunk version.


--
cheers
elvelind grandin

Kevin Cole

unread,
Sep 8, 2007, 1:47:19 PM9/8/07
to turbo...@googlegroups.com
On 9/8/07, Elvelind Grandin <elve...@gmail.com> wrote:

which means that you can just run

easy_install http://elixir.ematia.de/svn/elixir/trunk/
to get the latest trunk version.

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'
________________________________________________________________________________

Full log below:

$ ./start-qwert.py
/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().
/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/database.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/_cpserver.py",
  line 78, in _start
    Engine._start(self)
  File "/usr/lib/python2.4/site-packages/CherryPy-2.2.1-py2.4.egg/cherrypy/_cpengine.py",
  line 108, in _start
    func()
  File "/usr/lib/python2.4/site-packages/TurboGears-1.0.3.2-py2.4.egg/turbogears/startup.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'

Kevin Cole

unread,
Sep 8, 2007, 2:40:04 PM9/8/07
to turbo...@googlegroups.com
On 9/7/07, Florent Aide <floren...@gmail.com> wrote:

easy_install -U "SQLAlchemy==0.3.10"

This, on the other hand, worked great!  Thanks.

renier

unread,
Sep 8, 2007, 3:33:57 PM9/8/07
to TurboGears
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...

--Renier

Florent Aide

unread,
Sep 8, 2007, 3:49:53 PM9/8/07
to turbo...@googlegroups.com
renier a écrit :
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.

Cheers,
Florent.

renier

unread,
Sep 8, 2007, 8:16:11 PM9/8/07
to TurboGears
I agree. The fix should be in TurboGears. I believe the following
patch overcomes the create_session problem with SA 0.4 without
breaking SA 0.3.10:

--- database.py.orig 2007-09-08 20:03:37.000000000 -0400
+++ database.py 2007-09-08 20:05:03.000000000 -0400
@@ -56,7 +56,7 @@
if not metadata.is_bound():
bind_meta_data()

- return sqlalchemy.create_session()
+ return sqlalchemy.orm.create_session()

metadata = activemapper.metadata
session = activemapper.Objectstore(create_session)

Will post this to the trac.

--Renier

Florent Aide

unread,
Sep 9, 2007, 8:12:36 AM9/9/07
to turbo...@googlegroups.com
renier a écrit :

> - return sqlalchemy.create_session()
> + return sqlalchemy.orm.create_session()
>
>

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.

Cheers,
Florent.

renier

unread,
Sep 9, 2007, 10:14:13 AM9/9/07
to TurboGears
When do you think a release will be made with those SA 0.4 fixes?

--Renier

Florent Aide

unread,
Sep 9, 2007, 10:30:38 AM9/9/07
to turbo...@googlegroups.com
renier a écrit :

> When do you think a release will be made with those SA 0.4 fixes?
>
> --Renier
>
Thoses fixes are in the SVN since 1/2 an hour. As for a release I cannot
say :)
But it is really coming now some small fixes and we should be done.

Cheers,
Florent.

renier

unread,
Sep 14, 2007, 1:54:57 AM9/14/07
to TurboGears
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

--Renier

apm

unread,
Sep 14, 2007, 4:20:31 AM9/14/07
to TurboGears
Hi all

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.

Christoph Zwerschke

unread,
Sep 14, 2007, 4:42:21 AM9/14/07
to turbo...@googlegroups.com
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

-- Christoph

Werner F. Bruhin

unread,
Sep 14, 2007, 4:47:04 AM9/14/07
to turbo...@googlegroups.com
apm wrote:
> Hi all
>
> 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/tbtest.fdb"

Werner

apm

unread,
Sep 14, 2007, 5:18:47 AM9/14/07
to TurboGears
Thanks a lot for your help and recommendations Christoph and Werner.
It works now with the right version of SA installed.

Work can go on...

cheers
Andre


On Sep 14, 10:42 am, Christoph Zwerschke <c...@online.de> wrote:
> 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/.

Florent Aide

unread,
Sep 14, 2007, 11:01:55 AM9/14/07
to turbo...@googlegroups.com
On 9/14/07, apm <andre....@gmail.com> wrote:

> So, being prepared for things to come, I decided to use TG 1.0.3.2

Good choice :-)

> from turbogears.database import bind_meta_data, metadata
> ImportError: cannot import name bind_meta_data

try to install SA:

easy_install -U "SQLAlchemy==0.3.10"

to make sure you have it because it is not a direct requirement for TG 1.0.3


Cheers,
Florent Aide.

Reply all
Reply to author
Forward
0 new messages