Ubuntu 12.04 using python-turbogears 1.1.1

57 views
Skip to first unread message

kvaml

unread,
May 14, 2012, 4:09:24 PM5/14/12
to turbo...@googlegroups.com
I realize this is ancient code, but hoped this report might still be useful.  Ubuntu now mixes sqlalchemy 0.7 with turbogears 1.1.1.  Thesqlalchemy.exceptions module is now sqlalchemy.exc.

The import error was masked by the old logic making this more difficult than necessary to resolve.  I changed the import logic in database.py to be:

try:
    import sqlalchemy 
except ImportError:
    sqlalchemy = None
else:
    import sqlalchemy.orm
    from sqlalchemy import MetaData
    try:
        from sqlalchemy.exc import ArgumentError, OperationalError
    except ImportError:
        try:
            from sqlalchemy.orm.exc import ArgumentError, OperationalError
        except ImportError: # SQLAlchemy < 0.5
            from sqlalchemy.exceptions import ArgumentError, OperationalError

try:
    import sqlobject
except ImportError:
    sqlobject = None
else:
    from sqlobject.dbconnection import ConnectionHub, Transaction, TheURIOpener
    from sqlobject.util.threadinglocal import local as threading_local

This works for me.  It will raise ImportError if one of the subsequent imports does not work, while still properly catching the absence of sqlalchemy and sqlobject.  It minimizes the number of statements where the errors are suppressed.
database.py

Christoph Zwerschke

unread,
May 14, 2012, 6:08:56 PM5/14/12
to turbo...@googlegroups.com
Am 14.05.2012 22:09, schrieb kvaml:
> I realize this is ancient code, but hoped this report might still be
> useful. Ubuntu now mixes sqlalchemy 0.7 with turbogears 1.1.1.
> Thesqlalchemy.exceptions module is now sqlalchemy.exc.

This and other changes have been covered in 1.1.3 and 1.5.x already.

-- Christoph

alind

unread,
May 16, 2012, 2:26:21 AM5/16/12
to TurboGears
@op
In my point of view, It is better (and easy as well) to make a
virtualenv and start the development with recent version of TG.

Muhammet S. AYDIN

unread,
May 18, 2012, 7:02:21 AM5/18/12
to turbo...@googlegroups.com
Actually if you are a new user we strongly suggest using TurboGears 2.

Sent from my iPhone
> --
> You received this message because you are subscribed to the Google Groups "TurboGears" group.
> To post to this group, send email to turbo...@googlegroups.com.
> To unsubscribe from this group, send email to turbogears+...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/turbogears?hl=en.
>

kvaml

unread,
May 19, 2012, 8:53:01 AM5/19/12
to turbo...@googlegroups.com
This is an old web application.  My problems tracking down the import errors led to the email.
I'm glad that newer versions avoid this issue.


On Friday, May 18, 2012 7:02:21 AM UTC-4, Mengu wrote:
Actually if you are a new user we strongly suggest using TurboGears 2.

Sent from my iPhone

On 16 May 2012, at 09:26,wrote:

> @op
> In my point of view, It is better (and easy as well) to make a
> virtualenv and start the development with recent version of TG.
>
> On May 15, 3:08 am, Christoph Zwerschke  wrote:
>> Am 14.05.2012 22:09, schrieb kvaml:
>>
>>> I realize this is ancient code, but hoped this report might still be
>>> useful. Ubuntu now mixes sqlalchemy 0.7 with turbogears 1.1.1.
>>> Thesqlalchemy.exceptions module is now sqlalchemy.exc.
>>
>> This and other changes have been covered in 1.1.3 and 1.5.x already.
>>
>> -- Christoph
>
> --
> You received this message because you are subscribed to the Google Groups "TurboGears" group.
> To post to this group, send email to turbo...@googlegroups.com.
> To unsubscribe from this group, send email to turbogears+unsubscribe@googlegroups.com.

kvaml

unread,
May 19, 2012, 8:57:18 AM5/19/12
to turbo...@googlegroups.com
It is an existing application so that's why I'm using ancient code.
As best I can tell virtualenv puts the burden of managing security and bug fix releases on the user.  
I like having the Linux distributor handle those concerns.
Reply all
Reply to author
Forward
0 new messages