Hello, and interface problem with Autobahn Python on Debian Squeeze

#1

Hello all,

I’m new here because I’ve just started evaluating WAMP and Autobahn for a customer’s project. I did a lot of Python programming more than a decade ago, and these days I’m a hardware and embedded systems engineer mostly, but maintain quite a lot of software.

I have searched for an answer to my query but haven’t found anything either on the web or in this group, so here I am asking it.

For historical reasons I need to be able to run Autobahn on Debian Linux ‘Squeeze’ (version 6) on ARM. The standard version of Python on this is version 2.6.6. I have successfully installed Autobahn 0.9.1 using setup.py - all that went without problems. However, when I tried to run a test program, I ran into trouble:

Traceback (most recent call last):

File “”, line 1, in

File “/usr/lib/python2.6/dist-packages/zope/interface/declarations.py”, line 496, in call

raise TypeError("Can’t use implementer with classes. Use one of "

TypeError: Can’t use implementer with classes. Use one of the class-declaration functions instead.

Looking into things a little deeper, I find that the class WrappingWebSocketAdapter in twisted/websocket.py uses the construct

@implementer(ITransport)

The zope interface library installed on this version of Debian isn’t happy with that. Changing it to the old

implements(ITransport)

after the ‘class’ line makes everything work as it should.

As far as I can tell, the @implements decorator should be supported on Python 2.6, but for some reason mine isn’t happy with it.

I don’t want to have to hack the released version of Autobahn for my customer, so what’s the right thing to do here?

  • is there something amiss with the Autobahn 0.9.1 distribution?

  • is my Python 2.6.6 just broken?

  • should I just move to Python 3?

Thank you all

Chris Jones

Martin-Jones Technology Ltd

Cambridge, UK and Warsaw, Poland

0 Likes

#2

Chris,

Hello all,

I'm new here because I've just started evaluating WAMP and Autobahn for
a customer's project. I did a lot of Python programming more than a
decade ago, and these days I'm a hardware and embedded systems engineer
mostly, but maintain quite a lot of software.

Sound cool. The IoT wave is just on the rising ..

I have searched for an answer to my query but haven't found anything
either on the web or in this group, so here I am asking it.

For historical reasons I need to be able to run Autobahn on Debian Linux
'Squeeze' (version 6) on ARM. The standard version of Python on this is
version 2.6.6. I have successfully installed Autobahn 0.9.1 using
setup.py - all that went without problems. However, when I tried to run
a test program, I ran into trouble:

Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
   File
"/usr/lib/python2.6/dist-packages/zope/interface/declarations.py", line
496, in __call__
     raise TypeError("Can't use implementer with classes. Use one of "
TypeError: Can't use implementer with classes. Use one of the
class-declaration functions instead.

Looking into things a little deeper, I find that the class
WrappingWebSocketAdapter in twisted/websocket.py uses the construct

@implementer(ITransport)

The zope interface library installed on this version of Debian isn't
happy with that. Changing it to the old

implements(ITransport)

after the 'class' line makes everything work as it should.

As far as I can tell, the @implements decorator should be supported on
Python 2.6, but for some reason mine isn't happy with it.

I don't want to have to hack the released version of Autobahn for my
customer, so what's the right thing to do here?

- is there something amiss with the Autobahn 0.9.1 distribution?
- is my Python 2.6.6 just broken?
- should I just move to Python 3?

AutobahnPython is supposed to support Python 2.6. In fact, we support so many Python and network framework combinations that sometimes (still) issues pop up=(

Please file a bug on GitHub providing as much detail as possible: all of above, plus

Twisted and zope.interface versions installed on that system

···

Am 10.10.2014 17:22, schrieb Chris Jones:

==

The problem is:

"Deprecated the "class advice" APIs from zope.interface.declarations: implements, implementsOnly, and classProvides. In their place, prefer the equivalent class decorators: @implementer, @implementer_only, and @provider. Code which uses the deprecated APIs will not work as expected under Py3k."

https://pypi.python.org/pypi/zope.interface/4.1.1

==

Could you check if

classImplements(WrappingWebSocketAdapter, ITransport)

http://docs.zope.org/zope.interface/api.html#id11

works for you?

==

Whatever fix/workaround we do, we need to make sure all other supported environments still work (in particular, Python 3).

==

Moving to Python 3 when using Twisted is currently not yet a (completely) recommended way: Twisted is not yet fully ported to Py 3.

==

You might think about using virtualenv (http://virtualenv.readthedocs.org/en/latest/) to create an env for your app on the device, and then update zope.interface/Twisted therein. Probably worth trying, since that might just work.

Cheers,
/Tobias

Thank you all
Chris Jones
Martin-Jones Technology Ltd
Cambridge, UK and Warsaw, Poland

--
You received this message because you are subscribed to the Google
Groups "Autobahn" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to autobahnws+...@googlegroups.com
<mailto:autobahnws+...@googlegroups.com>.
To post to this group, send email to autob...@googlegroups.com
<mailto:autob...@googlegroups.com>.
To view this discussion on the web visit
https://groups.google.com/d/msgid/autobahnws/d3bf6e8f-0b67-4b15-80c4-d7f865a6817d%40googlegroups.com
<https://groups.google.com/d/msgid/autobahnws/d3bf6e8f-0b67-4b15-80c4-d7f865a6817d%40googlegroups.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.

0 Likes

#3

For historical reasons I need to be able to run Autobahn on Debian Linux

‘Squeeze’ (version 6) on ARM. The standard version of Python on this is

version 2.6.6. I have successfully installed Autobahn 0.9.1 using

setup.py - all that went without problems. However, when I tried to run

a test program, I ran into trouble:

Traceback (most recent call last):

File “”, line 1, in

File

“/usr/lib/python2.6/dist-packages/zope/interface/declarations.py”, line

496, in call

 raise TypeError("Can't use implementer with classes.  Use one of "

TypeError: Can’t use implementer with classes. Use one of the

class-declaration functions instead.

Looking into things a little deeper, I find that the class

WrappingWebSocketAdapter in twisted/websocket.py uses the construct

@implementer(ITransport)

The zope interface library installed on this version of Debian isn’t

happy with that. Changing it to the old

implements(ITransport)

after the ‘class’ line makes everything work as it should.

As far as I can tell, the @implements decorator should be supported on

Python 2.6, but for some reason mine isn’t happy with it.

I don’t want to have to hack the released version of Autobahn for my

customer, so what’s the right thing to do here?

  • is there something amiss with the Autobahn 0.9.1 distribution?
  • is my Python 2.6.6 just broken?
  • should I just move to Python 3?

AutobahnPython is supposed to support Python 2.6. In fact, we support so
many Python and network framework combinations that sometimes (still)
issues pop up=(

Please file a bug on GitHub providing as much detail as possible: all of
above, plus

Twisted and zope.interface versions installed on that system

Will do, but I’m away for couple of days now. I’ve just made a discovery: I couldn’t get anything using ApplicationSession to work on either my PC or the ARM platform, and uninstalled the Debian packages for zope.interface and twisted, replacing them with whatever pip would download (zope.interface 4.1.1, twisted 14.0.2). Now the @implementer problem has gone away. (yes, I did remember to change the code back!), so it looks like it had something to do with the zope.interface version.

==

The problem is:

“Deprecated the “class advice” APIs from zope.interface.declarations:
implements, implementsOnly, and classProvides. In their place, prefer
the equivalent class decorators: @implementer, @implementer_only, and
@provider. Code which uses the deprecated APIs will not work as expected
under Py3k.”

https://pypi.python.org/pypi/zope.interface/4.1.1

==

Could you check if

classImplements(WrappingWebSocketAdapter, ITransport)

http://docs.zope.org/zope.interface/api.html#id11

works for you?

I added it to the imports and then put that line after the class definition and yes, it does work, but this is with a newer version of zope.interface so I’d like to reproduce the problem with the old version when I get chance.

You might think about using virtualenv
(http://virtualenv.readthedocs.org/en/latest/) to create an env for your
app on the device, and then update zope.interface/Twisted therein.
Probably worth trying, since that might just work.

That’s a useful idea, thanks. I’m lucky, though, that the only Python application on this platform will be this one, so there shouldn’t be too many dependency problems once I’ve worked out what works!

Chris

0 Likes

#4

    Twisted and zope.interface versions installed on that system

Will do, but I'm away for couple of days now. I've just made a
discovery: I couldn't get anything using ApplicationSession to work on
either my PC or the ARM platform, and uninstalled the Debian packages
for zope.interface and twisted, replacing them with whatever pip would
download (zope.interface 4.1.1, twisted 14.0.2). Now the @implementer
problem has gone away. (yes, I did remember to change the code back!),
so it looks like it had something to do with the zope.interface version.

Ah, yeah. Good to hear it works for you now.

    You might think about using virtualenv
    (http://virtualenv.readthedocs.org/en/latest/
    <http://virtualenv.readthedocs.org/en/latest/>) to create an env for
    your
    app on the device, and then update zope.interface/Twisted therein.
    Probably worth trying, since that might just work.

That's a useful idea, thanks. I'm lucky, though, that the only Python
application on this platform will be this one, so there shouldn't be too
many dependency problems once I've worked out what works!

Ok, also fine. Just replace the old versions that come with the system - then you don't need to jump through the virtualenv loop.

Cheers,
/Tobias

0 Likes

#5

I’ve now gone through and reproduced the problem and raised an issue at GitHub:

https://github.com/tavendo/AutobahnJS/issues/110

it seems that it’s only the versions of zope.interface and twisted supplied with Debian Squeeze which cause the problem.

Incidentally, I tried the classImplements() thing with the Debian-installed libraries and it also fixed the trouble.

Chris

···

On Friday, October 10, 2014 7:46:18 PM UTC+2, Tobias Oberstein wrote:

Twisted and zope.interface versions installed on that system

Will do, but I’m away for couple of days now. I’ve just made a

discovery: I couldn’t get anything using ApplicationSession to work on

either my PC or the ARM platform, and uninstalled the Debian packages

for zope.interface and twisted, replacing them with whatever pip would

download (zope.interface 4.1.1, twisted 14.0.2). Now the @implementer

problem has gone away. (yes, I did remember to change the code back!),

so it looks like it had something to do with the zope.interface version.

Ah, yeah. Good to hear it works for you now.

0 Likes