On Dec 19, 2011, at 5:03 AM, useher wrote: > Hi! > > Sorry for the late answer. > I got it now: There was a relation called 'status' in the parent class > and a function called status() in the derived class. After renaming > the function everything seems to work correct. > So the error does not belong to sqlalchemy, but concerns some bad > coding by myself. > A short description is below the message. > > Thank you very much for your help!
thanks for the info ! I've captured this as http://www.sqlalchemy.org/trac/ticket/2352 where we might add a more informative error message. > > Uwe Seher > > > > What i have done: > changes in mapper.py: > > def _is_userland_descriptor(self, obj): > try: > return not isinstance(obj, > (MapperProperty, attributes.QueryableAttribute)) > and \ > hasattr(obj, '__get__') and not \ > isinstance(obj.__get__(None, obj), > attributes.QueryableAttribute) > except: > import pdb, sys > e,m,tb = sys.exc_info() > pdb.post_mortem(tb) > > What happens: > uwe@pallas:~/dev/python/endb> ./test_api.py > /usr/local/lib64/python2.6/site-packages/endblib/model/endbauth.py:42: > SADeprecationWarning: useexisting is deprecated. Use extend_existing. > schema=schemata['pub'], useexisting=True) > /usr/local/lib64/python2.6/site-packages/endblib/model/endbauth.py:51: > SADeprecationWarning: useexisting is deprecated. Use extend_existing. > schema=schemata['pub'], useexisting=True) > /usr/local/lib/python2.6/site-packages/SQLAlchemy-0.7.4-py2.6-linux- > x86_64.egg/sqlalchemy/ext/declarative.py:1172: SADeprecationWarning: > useexisting is deprecated. Use extend_existing. > **table_kw) >> /usr/local/lib/python2.6/site-packages/SQLAlchemy-0.7.4-py2.6-linux-x86_64.egg/sqlalchemy/orm/mapper.py(1459)_is_userland_descriptor() > -> isinstance(obj.__get__(None, obj), > (Pdb) args > self = Mapper|Facility|facilities > obj = <unbound method Facility.status> > (Pdb) > > The error does not happen anymore when importing the lib in idle, but > when running my testscript and using it. > The method in obj looks like this and is not finished at the moment. > If i comment it out, everything works. > > > On 15 Dez., 16:48, Michael Bayer <[email protected]> wrote: >> On Dec 15, 2011, at 2:38 AM, useher wrote: >> >>> I write a library with some classes that has to bundle function for >>> different applications accessing data on a PostgreSQL-9.x Server. >>> sqlalchemy is installed and maintained by easy_install not by >>> packetmanagement. After upgrading to 0.7.4 the following error occurs: >> >>> File "build/bdist.linux-x86_64/egg/sqlalchemy/orm/mapper.py", line >>> 1481, in _should_exclude >>> File "build/bdist.linux-x86_64/egg/sqlalchemy/orm/mapper.py", line >>> 1458, in _is_userland_descriptor >>> TypeError: Error when calling the metaclass bases >>> issubclass() arg 1 must be a class >> >> I need to see what "arg" actually is here - you'll note the SQLAlchemy code >> in question isn't calling issubclass(), it's calling isinstance(). It >> suggests that SQLA's invocation of the descriptor itself is resulting in an >> issubclass() call, though when I try to simulate this error the stack trace >> is explicit: >> >> File "/Users/classic/dev/sqlalchemy/lib/sqlalchemy/orm/mapper.py", line >> 1458, in _is_userland_descriptor >> isinstance(obj.__get__(None, obj), >> File "test.py", line 9, in __get__ >> if issubclass(owner, object): >> TypeError: Error when calling the metaclass bases >> issubclass() arg 1 must be a class >> >> so not sure why the actual source of issubclass() is not present in your >> stack trace. >> >> Can you just pdb into that section using pdb.post_mortem() and figure out >> what the descriptor in question is actually doing ? I'd like to >> understand what's going on before just putting in a blunt "except:". > > -- > You received this message because you are subscribed to the Google Groups > "sqlalchemy" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/sqlalchemy?hl=en. > -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
