Can't run the Calculator - connection refused, no standalone, etc.

#1

Hi,

I am trying to the calculator -

https://github.com/tavendo/AutobahnPython/tree/master/examples/twisted/wamp/app/calculator

here is my requirements.txt file:

Twisted==14.0.2
autobahn==0.9.4-2
six==1.8.0
wsgiref==0.1.2
zope.interface==4.1.1

And I am keep failing… I got few errors while trying to run “python calculator.py --debug” -

Standalone error:

I am getting the next error -

2014-12-26 15:52:42+0200 [-] Log opened.

2014-12-26 15:52:42+0200 [-] Using Twisted reactor <class ‘twisted.internet.selectreactor.SelectReactor’>

2014-12-26 15:52:42+0200 [-] Site starting on 8080

2014-12-26 15:52:42+0200 [-] Starting factory <twisted.web.server.Site instance at 0x1016a5710>

2014-12-26 15:52:42+0200 [-] Traceback (most recent call last):

2014-12-26 15:52:42+0200 [-] File “calculator.py”, line 118, in

2014-12-26 15:52:42+0200 [-] debug_app = args.debug # app-level logging

2014-12-26 15:52:42+0200 [-] TypeError: init() got an unexpected keyword argument 'standalone’

I solved this error by removing the standalone kwarg, the next I started the server again and I am getting the next error -

2014-12-26 15:51:30+0200 [-] Log opened.

2014-12-26 15:51:30+0200 [-] Using Twisted reactor <class ‘twisted.internet.selectreactor.SelectReactor’>

2014-12-26 15:51:31+0200 [-] Site starting on 8080

2014-12-26 15:51:31+0200 [-] Starting factory <twisted.web.server.Site instance at 0x1067d5710>

2014-12-26 15:51:31+0200 [-] Starting factory <autobahn.twisted.websocket.WampWebSocketClientFactory instance at 0x1067d5d40>

2014-12-26 15:51:31+0200 [Uninitialized] Stopping factory <autobahn.twisted.websocket.WampWebSocketClientFactory instance at 0x1067d5d40>

2014-12-26 15:51:36+0200 [HTTPChannel,0,127.0.0.1] Unhandled error in Deferred:

2014-12-26 15:51:36+0200 [HTTPChannel,0,127.0.0.1] Unhandled Error

*** Traceback (most recent call last):***

*** Failure: twisted.internet.error.ConnectionRefusedError: Connection was refused by other side: 61: Connection refused.***

2014-12-26 15:51:36+0200 [HTTPChannel,0,127.0.0.1] “127.0.0.1” - - [26/Dec/2014:13:51:36 +0000] “GET / HTTP/1.1” 304 - “-” “Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.45 Safari/537.36”

In my chrome devtools console I am getting the next error -

WebSocket connection to ‘ws://localhost:9000/’ failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED

What should I do? am I doing something wrong (because I really have that feeling…) ?

0 Likes

#2

Hi Yosi,

yes, I am sorry. This isn’t your fault, but ours: https://github.com/tavendo/AutobahnPython/issues/304

To run the examples, you will need a WAMP router running. One option is to use Crossbar.io:

pip install crossbar
cd $HOME/mynode
crossbar init
crossbar start

and then use a WebSocket URL “ws://localhost:8080/ws” in the client code.

Well, again sorry. All examples/docs need to be revised for this recent change.

/Tobias

···

Am Freitag, 26. Dezember 2014 14:54:38 UTC+1 schrieb Yosi Attias:

Hi,

I am trying to the calculator -

https://github.com/tavendo/AutobahnPython/tree/master/examples/twisted/wamp/app/calculator

here is my requirements.txt file:

Twisted==14.0.2
autobahn==0.9.4-2
six==1.8.0
wsgiref==0.1.2
zope.interface==4.1.1

And I am keep failing… I got few errors while trying to run “python calculator.py --debug” -

Standalone error:

I am getting the next error -

2014-12-26 15:52:42+0200 [-] Log opened.

2014-12-26 15:52:42+0200 [-] Using Twisted reactor <class ‘twisted.internet.selectreactor.SelectReactor’>

2014-12-26 15:52:42+0200 [-] Site starting on 8080

2014-12-26 15:52:42+0200 [-] Starting factory <twisted.web.server.Site instance at 0x1016a5710>

2014-12-26 15:52:42+0200 [-] Traceback (most recent call last):

2014-12-26 15:52:42+0200 [-] File “calculator.py”, line 118, in

2014-12-26 15:52:42+0200 [-] debug_app = args.debug # app-level logging

2014-12-26 15:52:42+0200 [-] TypeError: init() got an unexpected keyword argument 'standalone’

I solved this error by removing the standalone kwarg, the next I started the server again and I am getting the next error -

2014-12-26 15:51:30+0200 [-] Log opened.

2014-12-26 15:51:30+0200 [-] Using Twisted reactor <class ‘twisted.internet.selectreactor.SelectReactor’>

2014-12-26 15:51:31+0200 [-] Site starting on 8080

2014-12-26 15:51:31+0200 [-] Starting factory <twisted.web.server.Site instance at 0x1067d5710>

2014-12-26 15:51:31+0200 [-] Starting factory <autobahn.twisted.websocket.WampWebSocketClientFactory instance at 0x1067d5d40>

2014-12-26 15:51:31+0200 [Uninitialized] Stopping factory <autobahn.twisted.websocket.WampWebSocketClientFactory instance at 0x1067d5d40>

2014-12-26 15:51:36+0200 [HTTPChannel,0,127.0.0.1] Unhandled error in Deferred:

2014-12-26 15:51:36+0200 [HTTPChannel,0,127.0.0.1] Unhandled Error

*** Traceback (most recent call last):***

*** Failure: twisted.internet.error.ConnectionRefusedError: Connection was refused by other side: 61: Connection refused.***

2014-12-26 15:51:36+0200 [HTTPChannel,0,127.0.0.1] “127.0.0.1” - - [26/Dec/2014:13:51:36 +0000] “GET / HTTP/1.1” 304 - “-” “Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.45 Safari/537.36”

In my chrome devtools console I am getting the next error -

WebSocket connection to ‘ws://localhost:9000/’ failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED

What should I do? am I doing something wrong (because I really have that feeling…) ?

0 Likes

#3

Hi Tobias,

How does this work when you have two python based clients that need to access the same router?

For example, I have two arduino Yun’s, one is a master and one is a slave.

I am using a modified version of your serial2ws.py script which receives an integer for a button press from the onboard master leonardo, which then passes this off to a browser on a windows machine for some interesting things to happen, but I am also looking to have the second Arduino Yun subscribe to this event so that it too can receive the JSON object and pass the button integer back down to it’s own on board Arduino Leonardo.

When trying to use some of your examples on autobahn to work across the linux machines and the respective IP network between them I am constantly receiving the errors above.

The reason I am led to believe is due to a lack of a WAMP router between them, so I am installing crossbar on the master Yun as I type (which also has a host of problems and I have had to reset my Yun entirely to factory default in order to get to more than half way through the setup without the linux core restarting - any ideas whats causing this?)

So once(if) I have crossbar installed and running, how do I configure each of the python scripts so that they connect to the crossbar router/arduino yun master python script instance running on the master Yun? Is this router needed at all - can the host/master python instance not manage the connections?

Thanks for any help you can offer with this.

Best,

Scott.

0 Likes

#4

Hi Tobias,

I have since spent the last couple of hours trying to install crossbar, but found there is indeed errors in the cryptography package which is preventing installation and forcing a dirty restart.

Here is an example of my output:

root@PlotMaster:~# opkg install yun-gcc_4.6.2-2_ar71xx.ipk

Installing yun-gcc (4.6.2-2) to root…

Configuring yun-gcc.

root@PlotMaster:~# pip install cryptography

Collecting cryptography

Using cached cryptography-0.8.1.tar.gz

Collecting pyasn1 (from cryptography)

Using cached pyasn1-0.1.7.tar.gz

Requirement already satisfied (use --upgrade to upgrade): six>=1.4.1 in /usr/lib/python2.7/site-packages/six-1.9.0-py2.7.egg (from cryptography)

Requirement already satisfied (use --upgrade to upgrade): setuptools in /usr/lib/python2.7/site-packages/setuptools-6.0.2-py2.7.egg (from cryptography)

Collecting enum34 (from cryptography)

Using cached enum34-1.0.4.tar.gz

Collecting cffi>=0.8 (from cryptography)

Using cached cffi-0.9.2.tar.gz

cc1: error: unrecognized command line option ‘-fhonour-copts’

cc1: error: unrecognized command line option ‘-fhonour-copts’

cc1: error: unrecognized command line option ‘-fhonour-copts’

cc1: error: unrecognized command line option ‘-fhonour-copts’

No working compiler found, or bogus compiler options

passed to the compiler from Python’s distutils module.

See the error messages above.

(If they are about -mno-fused-madd and you are on OS/X 10.8,

see http://stackoverflow.com/questions/22313407/ .)

Complete output from command python setup.py egg_info:

cc1: error: unrecognized command line option ‘-fhonour-copts’

cc1: error: unrecognized command line option ‘-fhonour-copts’

cc1: error: unrecognized command line option ‘-fhonour-copts’

cc1: error: unrecognized command line option ‘-fhonour-copts’

No working compiler found, or bogus compiler options

passed to the compiler from Python’s distutils module.

See the error messages above.

(If they are about -mno-fused-madd and you are on OS/X 10.8,

see http://stackoverflow.com/questions/22313407/ .)

···

Command “python setup.py egg_info” failed with error code 1 in /tmp/pip-build-iFj2Ra/cffi

I can see that you posted on twitter a post that you managed to get crossbar.io installed. Did you have to go through any special procedures to get this to work, if so, could you share and advise me further?

I have spent the best part of the last 6 weeks learning twisted, autobahn, wamp and crossbar code and the last thing I want to do is switch to another API as I can see solid potential in these API’s and my future work, and I have a 4 week deadline for a project I am incorporating some of this into, so can’t afford the time.

Any help you can offer would be deeply appreciated!

Best Regards,

Scott.

0 Likes

#5

Hi Scott,

yes, I got Crossbar.io running on the Yun. I need to write that up though.

If you want to hook up multiple Yuns via Crossbar.io, I'd have
Crossbar.io running on a central box (like your Notebook), and just use
AutobahnPython on the Yuns itself. Much easier, and definitely easier
for development.

The app components running on the Yuns (written using AutobahnPython)
will all connect to your centrally running router. Also all the browsers
of course will connect to that same router.

The quickest way of using AutobahnPython on the Yun is using

pip install autobahn[asyncio]

This is because it only drags in the asyncio fallback for Python 2
(called "Trollius"). This isn't describe in the blog post, but it should
just work.

Twisted is a larger depedency, which due to the limited space on the Yun
complicates things as the blog post outlines.

If you already got through installing AutobahnPython|Twisted, then use
that. Doesn't matter.

Getting Crossbar.io _itself_ run on the Yun is more work than above, and
I wouldn't bother with that for now - you want to get to your actual
application.

Even if you ultimately want to run Crossbar.io on Yun, we can address
that later.

I am sorry for not updating the blog post (and not writing the follow up
post I announce there) -- I just need to find some hours time.

Anyway, hope above helps a little already.

Cheers,
/Tobias

···

Am 30.03.2015 um 19:53 schrieb Scott Alan Lawson:

Hi Tobias,

I have since spent the last couple of hours trying to install crossbar, but
found there is indeed errors in the cryptography package which is
preventing installation and forcing a dirty restart.

Here is an example of my output:

root@PlotMaster:~# opkg install yun-gcc_4.6.2-2_ar71xx.ipk
Installing yun-gcc (4.6.2-2) to root...
Configuring yun-gcc.
root@PlotMaster:~# pip install cryptography
Collecting cryptography
  Using cached cryptography-0.8.1.tar.gz
Collecting pyasn1 (from cryptography)
  Using cached pyasn1-0.1.7.tar.gz
Requirement already satisfied (use --upgrade to upgrade): six>=1.4.1 in
/usr/lib/python2.7/site-packages/six-1.9.0-py2.7.egg (from cryptography)
Requirement already satisfied (use --upgrade to upgrade): setuptools in
/usr/lib/python2.7/site-packages/setuptools-6.0.2-py2.7.egg (from
cryptography)
Collecting enum34 (from cryptography)
  Using cached enum34-1.0.4.tar.gz
Collecting cffi>=0.8 (from cryptography)
  Using cached cffi-0.9.2.tar.gz
    cc1: error: unrecognized command line option '-fhonour-copts'
    cc1: error: unrecognized command line option '-fhonour-copts'
    cc1: error: unrecognized command line option '-fhonour-copts'
    cc1: error: unrecognized command line option '-fhonour-copts'
        No working compiler found, or bogus compiler options
        passed to the compiler from Python's distutils module.
        See the error messages above.
        (If they are about -mno-fused-madd and you are on OS/X 10.8,
        see http://stackoverflow.com/questions/22313407/ .)
    Complete output from command python setup.py egg_info:
    cc1: error: unrecognized command line option '-fhonour-copts'

    cc1: error: unrecognized command line option '-fhonour-copts'

    cc1: error: unrecognized command line option '-fhonour-copts'

    cc1: error: unrecognized command line option '-fhonour-copts'

        No working compiler found, or bogus compiler options

        passed to the compiler from Python's distutils module.

        See the error messages above.

        (If they are about -mno-fused-madd and you are on OS/X 10.8,

        see http://stackoverflow.com/questions/22313407/ .)

    ----------------------------------------
    Command "python setup.py egg_info" failed with error code 1 in
/tmp/pip-build-iFj2Ra/cffi

I can see that you posted on twitter a post that you managed to get
crossbar.io installed. Did you have to go through any special procedures to
get this to work, if so, could you share and advise me further?

I have spent the best part of the last 6 weeks learning twisted, autobahn,
wamp and crossbar code and the last thing I want to do is switch to another
API as I can see solid potential in these API's and my future work, and I
have a 4 week deadline for a project I am incorporating some of this into,
so can't afford the time.

Any help you can offer would be deeply appreciated!

Best Regards,

Scott.

0 Likes

#6

Hi Scott,

Hi Tobias,

How does this work when you have two python based clients that need to
access the same router?

Maybe this helps:

http://crossbar.io/static/img/gen/iot_draft.png

Say you have 2 Yuns and 3 browsers.

You will need a central router, eg running on your notebook. All 3
clients (the 2 Yuns and 3 browsers) connect to the same, central router.

All clients can then transparently talk to each other.

Say your notebook gets IP 192.168.1.10 on your local network.

You would then configure the components on the Yuns to connect to

ws://192.168.1.10:8080/ws

(This assumes a default Crossbar.io node config).

You would enter

http://192.168.1.10:8080

in your browser to get the frontend HTML. Within that frontend, the
AutobahnJS code would use the same WebSocket URL as above to connect to
Crossbar.io

···

Am 30.03.2015 um 17:49 schrieb Scott Alan Lawson:

For example, I have two arduino Yun's, one is a master and one is a slave.

I am using a modified version of your serial2ws.py script which receives an
integer for a button press from the onboard master leonardo, which then
passes this off to a browser on a windows machine for some interesting
things to happen, but I am also looking to have the second Arduino Yun
subscribe to this event so that it too can receive the JSON object and pass
the button integer back down to it's own on board Arduino Leonardo.

When trying to use some of your examples on autobahn to work across the
linux machines and the respective IP network between them I am constantly
receiving the errors above.

The reason I am led to believe is due to a lack of a WAMP router between
them, so I am installing crossbar on the master Yun as I type (which also
has a host of problems and I have had to reset my Yun entirely to factory
default in order to get to more than half way through the setup without the
linux core restarting - any ideas whats causing this?)

So once(if) I have crossbar installed and running, how do I configure each
of the python scripts so that they connect to the crossbar router/arduino
yun master python script instance running on the master Yun? Is this router
needed at all - can the host/master python instance not manage the
connections?

Thanks for any help you can offer with this.

Best,

Scott.

0 Likes