I'm sure you hit the "print" statement also.  The example uses a metaclass.  
Metaclasses in Py3k look like:

class DeclEnum(metaclass=EnumMeta):
    """Declarative enumeration."""

   # ...


if you run 2to3 on the script these changes are made and it works fine:

2to3 -w decl_enum.py






On May 12, 2013, at 1:31 PM, Alexey Vihorev <viho...@gmail.com> wrote:

> Hi!
>  
> I’m trying to run enum example provided here 
> http://techspot.zzzeek.org/files/2011/decl_enum.py and it fails with this:
>  
> C:\Python32\lib\site-packages\sqlalchemy\sql\expression.py:1983: SAWarning: 
> The IN-predicate on "employee.type" was invoked with an empty sequence. This 
> results in a contradiction, which nonetheless can be expensive to evaluate.  
> Consider alternative strategies for improved performance.
>   return o[0](self, self.expr, op, *(other + o[1:]), **kwargs)
> Traceback (most recent call last):
>   File "C:\Python32\lib\site-packages\sqlalchemy\engine\base.py", line 824, 
> in _execute_context
>     context = constructor(dialect, self, conn, *args)
>   File "C:\Python32\lib\site-packages\sqlalchemy\engine\default.py", line 
> 461, in _init_compiled
>     param.append(processors[key](compiled_params[key]))
>   File "C:\Python32\lib\site-packages\sqlalchemy\types.py", line 758, in 
> process
>     return process_param(value, dialect)
>   File "C:/Users/Alexey/experimental/ decl_enum.py ", line 86, in 
> process_bind_param
>     return value.value
> AttributeError: 'tuple' object has no attribute 'value'
>  
> I’m running python 3.2 on win32 and sqla 0.8.1. As I understand it, it’s 
> because of py3. Is there an updated version of the example? Thanks.
>  
>  
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "sqlalchemy" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email tosqlalchemy+unsubscr...@googlegroups.com.
> To post to this group, send email to sqlalchemy@googlegroups.com.
> Visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>  
>  

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to