2

I just took this example directly from Autobahn, saved it as a Python script, then transferred it to a Debian 9 distribution running Python 3.5.3.

I'm trying to convert this file into an executable binary.

I saved the file as defer4.py. I then ran:

cython --embed -o defer4.c defer4.py;
gcc -Os -I /usr/include/python3.5m -o defer4 defer4.c -lpython3.5m -lpthread -lm -lutil -ldl

This created an executable called defer4 in the same folder. I then run ./defer4 and get this error:

2018-04-17T21:20:56-0400 connecting once using transport type "websocket" over endpoint "tcp"
2018-04-17T21:20:56-0400 Starting factory <autobahn.twisted.websocket.WampWebSocketClientFactory object at 0xb5a8c730>
2018-04-17T21:20:56-0400 While notifying 'join': Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/autobahn/wamp/protocol.py", line 508, in success
    d = self.fire('join', self, details)
  File "/usr/local/lib/python3.5/dist-packages/autobahn/util.py", line 817, in fire
    res.append(self._parent.fire(event, *args, **kwargs))
  File "/usr/local/lib/python3.5/dist-packages/autobahn/util.py", line 814, in fire
    future = txaio.as_future(handler, *args, **kwargs)
  File "/usr/local/lib/python3.5/dist-packages/txaio/tx.py", line 417, in as_future
    return maybeDeferred(fun, *args, **kwargs)
--- <exception caught here> ---
  File "/usr/local/lib/python3.5/dist-packages/twisted/internet/defer.py", line 150, in maybeDeferred
    result = f(*args, **kw)
  File "/usr/local/lib/python3.5/dist-packages/twisted/internet/defer.py", line 1531, in unwindGenerator
    "instead got %r" % (f, gen))
builtins.TypeError: inlineCallbacks requires <cyfunction join at 0xb5a68030> to produce a generator; instead got <generator object at 0xb5a49300>

2018-04-17T21:20:56-0400 Unhandled error in Deferred:
2018-04-17T21:20:56-0400 Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/autobahn/wamp/protocol.py", line 508, in success
    d = self.fire('join', self, details)
  File "/usr/local/lib/python3.5/dist-packages/autobahn/util.py", line 817, in fire
    res.append(self._parent.fire(event, *args, **kwargs))
  File "/usr/local/lib/python3.5/dist-packages/autobahn/util.py", line 814, in fire
    future = txaio.as_future(handler, *args, **kwargs)
  File "/usr/local/lib/python3.5/dist-packages/txaio/tx.py", line 417, in as_future
    return maybeDeferred(fun, *args, **kwargs)
--- <exception caught here> ---
  File "/usr/local/lib/python3.5/dist-packages/twisted/internet/defer.py", line 150, in maybeDeferred
    result = f(*args, **kw)
  File "/usr/local/lib/python3.5/dist-packages/twisted/internet/defer.py", line 1531, in unwindGenerator
    "instead got %r" % (f, gen))
builtins.TypeError: inlineCallbacks requires <cyfunction join at 0xb5a68030> to produce a generator; instead got <generator object at 0xb5a49300>

2018-04-17T21:20:56-0400 Unhandled error in Deferred:
2018-04-17T21:20:56-0400 Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/autobahn/wamp/protocol.py", line 508, in success
    d = self.fire('join', self, details)
  File "/usr/local/lib/python3.5/dist-packages/autobahn/util.py", line 817, in fire
    res.append(self._parent.fire(event, *args, **kwargs))
  File "/usr/local/lib/python3.5/dist-packages/autobahn/util.py", line 814, in fire
    future = txaio.as_future(handler, *args, **kwargs)
  File "/usr/local/lib/python3.5/dist-packages/txaio/tx.py", line 417, in as_future
    return maybeDeferred(fun, *args, **kwargs)
--- <exception caught here> ---
  File "/usr/local/lib/python3.5/dist-packages/twisted/internet/defer.py", line 150, in maybeDeferred
    result = f(*args, **kw)
  File "/usr/local/lib/python3.5/dist-packages/twisted/internet/defer.py", line 1531, in unwindGenerator
    "instead got %r" % (f, gen))
builtins.TypeError: inlineCallbacks requires <cyfunction join at 0xb5a68030> to produce a generator; instead got <generator object at 0xb5a49300>

I've been going through some of the docs to find out if there's something about the new Python that might be creating an issue, or if new Python is changing the way it's handling deferreds / generators. I cannot find anything yet.

Do you know why this issue is being caused even by Autobahn's own example?

sscirrus
  • 55,407
  • 41
  • 135
  • 228

1 Answers1

-1

There isn't anything changed in Python that should be breaking that, I just tested it on Ubuntu 16.04 and 18.04 systems, with python 3.5.2 and 3.6.5 respectively and all works fine.

So the problem is with way you are trying to run this, which isn't officially supported by autobahn, so you are pretty much on your own unfortunately.

Omer Akram
  • 31
  • 3
  • When you say 'the way you are trying to run this', do you mean purely that I'm trying to incorporate Autobahn, or is there something else? – sscirrus May 11 '18 at 19:20