12.04 basic autobahn install fails

#1

Hi,

I’m in a terrible pinch here. I have autobahn working flawlessly on my development server (ubuntu 14.04) and I needed to move it to the live server (12.04 ubuntu) today but it fails with a couple things I can’t figure out. I know this is nobody’s problem but mine, but this is supposed to be operating today.

When trying to run the code I get first a warning then an error

UserWarning: Module twisted was already imported from /usr/lib/python2.7/dist-packages/twisted/init.pyc, but /usr/local/lib/python2.7/dist-packages/autobahn-0.9.0-py2.7.egg is being added to sys.path

Traceback (most recent call last):

File “websocket_server.py”, line 10, in

from autobahn.websocket import listenWS

ImportError: cannot import name listenWS

Here is the code

#!/usr/bin/python

import sys

from twisted.python import log

from twisted.internet import reactor

from twisted.web.server import Site

from twisted.web.static import File

from autobahn.websocket import listenWS

from autobahn.wamp import WampServerFactory, \

								WampServerProtocol

class PubSubServer1(WampServerProtocol):

def onSessionOpen(self):

	## register a single, fixed URI as PubSub topic

	self.registerForPubSub("http://test")

	## register a URI and all URIs having the string as prefix as PubSub topic

	self.registerForPubSub("http://example.com/event#", True)

if name == ‘main’:

log.startLogging(sys.stdout)

debug = len(sys.argv) > 1 and sys.argv[1] == 'debug'

factory = WampServerFactory("ws://localhost:9000", debugWamp = debug)

factory.protocol = PubSubServer1

factory.setProtocolOptions(allowHixie76 = True)

listenWS(factory)

webdir = File(".")

web = Site(webdir)

reactor.listenTCP(8080, web)

reactor.run()
0 Likes

#2

For the moment I am running the websocket server off my dev server. But it’s not ideal of course.

···

On Tuesday, September 9, 2014 4:33:45 PM UTC-7, Trendal Toews wrote:

Hi,

I’m in a terrible pinch here. I have autobahn working flawlessly on my development server (ubuntu 14.04) and I needed to move it to the live server (12.04 ubuntu) today but it fails with a couple things I can’t figure out. I know this is nobody’s problem but mine, but this is supposed to be operating today.

When trying to run the code I get first a warning then an error

UserWarning: Module twisted was already imported from /usr/lib/python2.7/dist-packages/twisted/init.pyc, but /usr/local/lib/python2.7/dist-packages/autobahn-0.9.0-py2.7.egg is being added to sys.path

Traceback (most recent call last):

File “websocket_server.py”, line 10, in

from autobahn.websocket import listenWS

ImportError: cannot import name listenWS

Here is the code

#!/usr/bin/python

import sys

from twisted.python import log

from twisted.internet import reactor

from twisted.web.server import Site

from twisted.web.static import File

from autobahn.websocket import listenWS

from autobahn.wamp import WampServerFactory, \

  							WampServerProtocol

class PubSubServer1(WampServerProtocol):

def onSessionOpen(self):

  ## register a single, fixed URI as PubSub topic
  self.registerForPubSub("[http://test](http://test)")
  ## register a URI and all URIs having the string as prefix as PubSub topic
  self.registerForPubSub("[http://example.com/event#](http://example.com/event#)", True)

if name == ‘main’:

log.startLogging(sys.stdout)

debug = len(sys.argv) > 1 and sys.argv[1] == ‘debug’

factory = WampServerFactory(“ws://localhost:9000”, debugWamp = debug)

factory.protocol = PubSubServer1

factory.setProtocolOptions(allowHixie76 = True)

listenWS(factory)

webdir = File(".")

web = Site(webdir)

reactor.listenTCP(8080, web)

reactor.run()

0 Likes

#3

Hi Trendal,

> I'm in a terrible pinch here. I have autobahn working flawlessly on

    my development server (ubuntu 14.04) and I needed to move it to the
    live server (12.04 ubuntu) today but it fails with a couple things I
    can't figure out. I know this is nobody's problem but mine, but
    this is supposed to be operating today.

Most likely you are using a different version of Autobahn on your dev machine. Pls see below ..

    When trying to run the code I get first a warning then an error

    UserWarning: Module twisted was already imported from
    /usr/lib/python2.7/dist-packages/twisted/__init__.pyc, but
    /usr/local/lib/python2.7/dist-packages/autobahn-0.9.0-py2.7.egg is
    being added to sys.path

    Traceback (most recent call last):
       File "websocket_server.py", line 10, in <module>
         from autobahn.websocket import listenWS
    ImportError: cannot import name listenWS

    Here is the code

    #!/usr/bin/python

    import sys
    from twisted.python import log
    from twisted.internet import reactor
    from twisted.web.server import Site
    from twisted.web.static import File
    from autobahn.websocket import listenWS
    from autobahn.wamp import WampServerFactory, \
    WampServerProtocol
    class PubSubServer1(WampServerProtocol):
    def onSessionOpen(self):

The code seem to be written for an very old version of Autobahn .. probably 0.5.x, since it is WAMP v1 code, and since it is importing the WAMP v1 classes from autobahn.wamp, not autobahn.wamp1.

You have these options:

1) install the exact same Autobahn on your server as your dev host
2) use Autobahn 0.8.15 (https://pypi.python.org/pypi/autobahn/0.8.15). this is the last version of Autobahn with WAMP1, but you will need to change your import statements
3) upgrade your code to WAMP v2. Then you can use Autobahn 0.9 and later

Hope this helps (pls let me know if not) ..
/Tobias

0 Likes

#4

Awesome. Thanks. Yeah I’ve had this copy of autobahn on my dev server for a long time. Never gave it a thought the version might have changed. On 14.04 I can find the python-autobahn package in the repos but I couldn’t seem to locate it for 12.04 so I just downloaded it and installed it manually. I was in too much of a hurry to think straight. I’ll figure out what version I have on the live server and get the code straightened out.

What about the Javascript client for the browsers then? I just used whatever package I had laying around on my dev server for my clients. Will I need to upgrade that as well when I move to the newer version?

My application isn’t built entirely on autobahn. I just use it to keep my clients in sync with a handle full of different topics. Clients post an empty message on what ever topic they have updated and the other clients then update their relevant data blocks. In the future I would like to start getting rid of the duplicate api requests from each client and just pass the data straight across the websocket.

Just looking now, I have 0.8.1 on my live server. I tried changing the import statement to autobahn.wamp1 but that didn’t to work. But I’ll get serious with it a little later today and make it work.

Thanks again.

···

On Tuesday, September 9, 2014 4:33:45 PM UTC-7, Trendal Toews wrote:

Hi,

I’m in a terrible pinch here. I have autobahn working flawlessly on my development server (ubuntu 14.04) and I needed to move it to the live server (12.04 ubuntu) today but it fails with a couple things I can’t figure out. I know this is nobody’s problem but mine, but this is supposed to be operating today.

When trying to run the code I get first a warning then an error

UserWarning: Module twisted was already imported from /usr/lib/python2.7/dist-packages/twisted/init.pyc, but /usr/local/lib/python2.7/dist-packages/autobahn-0.9.0-py2.7.egg is being added to sys.path

Traceback (most recent call last):

File “websocket_server.py”, line 10, in

from autobahn.websocket import listenWS

ImportError: cannot import name listenWS

Here is the code

#!/usr/bin/python

import sys

from twisted.python import log

from twisted.internet import reactor

from twisted.web.server import Site

from twisted.web.static import File

from autobahn.websocket import listenWS

from autobahn.wamp import WampServerFactory, \

  							WampServerProtocol

class PubSubServer1(WampServerProtocol):

def onSessionOpen(self):

  ## register a single, fixed URI as PubSub topic
  self.registerForPubSub("[http://test](http://test)")
  ## register a URI and all URIs having the string as prefix as PubSub topic
  self.registerForPubSub("[http://example.com/event#](http://example.com/event#)", True)

if name == ‘main’:

log.startLogging(sys.stdout)

debug = len(sys.argv) > 1 and sys.argv[1] == ‘debug’

factory = WampServerFactory(“ws://localhost:9000”, debugWamp = debug)

factory.protocol = PubSubServer1

factory.setProtocolOptions(allowHixie76 = True)

listenWS(factory)

webdir = File(".")

web = Site(webdir)

reactor.listenTCP(8080, web)

reactor.run()

0 Likes

#5

Hi Trendal,

yes, you’ll have to update Autobahn|JS as well. WAMP v2 changes quite a bit about the protocol, and is not compatible with any WAMP v1 libraries.

Unlike Autobahn|Python, there’s no support for both WAMP versions in any version of Autobahn|JS - it’s WAMP v1 up to 0.8.2, and WAMP v2 after that.

Regards,

Alex

···

Am Mittwoch, 10. September 2014 16:02:41 UTC+2 schrieb Trendal Toews:

Awesome. Thanks. Yeah I’ve had this copy of autobahn on my dev server for a long time. Never gave it a thought the version might have changed. On 14.04 I can find the python-autobahn package in the repos but I couldn’t seem to locate it for 12.04 so I just downloaded it and installed it manually. I was in too much of a hurry to think straight. I’ll figure out what version I have on the live server and get the code straightened out.

What about the Javascript client for the browsers then? I just used whatever package I had laying around on my dev server for my clients. Will I need to upgrade that as well when I move to the newer version?

My application isn’t built entirely on autobahn. I just use it to keep my clients in sync with a handle full of different topics. Clients post an empty message on what ever topic they have updated and the other clients then update their relevant data blocks. In the future I would like to start getting rid of the duplicate api requests from each client and just pass the data straight across the websocket.

Just looking now, I have 0.8.1 on my live server. I tried changing the import statement to autobahn.wamp1 but that didn’t to work. But I’ll get serious with it a little later today and make it work.

Thanks again.

On Tuesday, September 9, 2014 4:33:45 PM UTC-7, Trendal Toews wrote:

Hi,

I’m in a terrible pinch here. I have autobahn working flawlessly on my development server (ubuntu 14.04) and I needed to move it to the live server (12.04 ubuntu) today but it fails with a couple things I can’t figure out. I know this is nobody’s problem but mine, but this is supposed to be operating today.

When trying to run the code I get first a warning then an error

UserWarning: Module twisted was already imported from /usr/lib/python2.7/dist-packages/twisted/init.pyc, but /usr/local/lib/python2.7/dist-packages/autobahn-0.9.0-py2.7.egg is being added to sys.path

Traceback (most recent call last):

File “websocket_server.py”, line 10, in

from autobahn.websocket import listenWS

ImportError: cannot import name listenWS

Here is the code

#!/usr/bin/python

import sys

from twisted.python import log

from twisted.internet import reactor

from twisted.web.server import Site

from twisted.web.static import File

from autobahn.websocket import listenWS

from autobahn.wamp import WampServerFactory, \

  							WampServerProtocol

class PubSubServer1(WampServerProtocol):

def onSessionOpen(self):
  ## register a single, fixed URI as PubSub topic
  self.registerForPubSub("[http://test](http://test)")
  ## register a URI and all URIs having the string as prefix as PubSub topic
  self.registerForPubSub("[http://example.com/event#](http://example.com/event#)", True)

if name == ‘main’:

log.startLogging(sys.stdout)
debug = len(sys.argv) > 1 and sys.argv[1] == 'debug'
factory = WampServerFactory("ws://localhost:9000", debugWamp = debug)
factory.protocol = PubSubServer1
factory.setProtocolOptions(allowHixie76 = True)
listenWS(factory)
webdir = File(".")
web = Site(webdir)
reactor.listenTCP(8080, web)
reactor.run()
0 Likes

#6

Okay, maybe due to time constraints I’ll move my live server back to the old copy I have that is working and then after this season I’ll upgrade it all. It’s a seasonal web application. Used from September through October.

I really didn’t do enough research. My apologies, I’ll put it all back right when I get a chance. And I’ll get to see whats new and exciting to use for next year.

Thanks.

···

On Wed, Sep 10, 2014 at 7:38 AM, Alexander Gödde alexande...@googlemail.com wrote:

Hi Trendal,

yes, you’ll have to update Autobahn|JS as well. WAMP v2 changes quite a bit about the protocol, and is not compatible with any WAMP v1 libraries.

Unlike Autobahn|Python, there’s no support for both WAMP versions in any version of Autobahn|JS - it’s WAMP v1 up to 0.8.2, and WAMP v2 after that.

Regards,

Alex

Am Mittwoch, 10. September 2014 16:02:41 UTC+2 schrieb Trendal Toews:

Awesome. Thanks. Yeah I’ve had this copy of autobahn on my dev server for a long time. Never gave it a thought the version might have changed. On 14.04 I can find the python-autobahn package in the repos but I couldn’t seem to locate it for 12.04 so I just downloaded it and installed it manually. I was in too much of a hurry to think straight. I’ll figure out what version I have on the live server and get the code straightened out.

What about the Javascript client for the browsers then? I just used whatever package I had laying around on my dev server for my clients. Will I need to upgrade that as well when I move to the newer version?

My application isn’t built entirely on autobahn. I just use it to keep my clients in sync with a handle full of different topics. Clients post an empty message on what ever topic they have updated and the other clients then update their relevant data blocks. In the future I would like to start getting rid of the duplicate api requests from each client and just pass the data straight across the websocket.

Just looking now, I have 0.8.1 on my live server. I tried changing the import statement to autobahn.wamp1 but that didn’t to work. But I’ll get serious with it a little later today and make it work.

Thanks again.

On Tuesday, September 9, 2014 4:33:45 PM UTC-7, Trendal Toews wrote:

Hi,

I’m in a terrible pinch here. I have autobahn working flawlessly on my development server (ubuntu 14.04) and I needed to move it to the live server (12.04 ubuntu) today but it fails with a couple things I can’t figure out. I know this is nobody’s problem but mine, but this is supposed to be operating today.

When trying to run the code I get first a warning then an error

UserWarning: Module twisted was already imported from /usr/lib/python2.7/dist-packages/twisted/init.pyc, but /usr/local/lib/python2.7/dist-packages/autobahn-0.9.0-py2.7.egg is being added to sys.path

Traceback (most recent call last):

File “websocket_server.py”, line 10, in

from autobahn.websocket import listenWS

ImportError: cannot import name listenWS

Here is the code

#!/usr/bin/python

import sys

from twisted.python import log

from twisted.internet import reactor

from twisted.web.server import Site

from twisted.web.static import File

from autobahn.websocket import listenWS

from autobahn.wamp import WampServerFactory, \

  							WampServerProtocol

class PubSubServer1(WampServerProtocol):

def onSessionOpen(self):
  ## register a single, fixed URI as PubSub topic
  self.registerForPubSub("[http://test](http://test)")
  ## register a URI and all URIs having the string as prefix as PubSub topic
  self.registerForPubSub("[http://example.com/event#](http://example.com/event#)", True)

if name == ‘main’:

log.startLogging(sys.stdout)
debug = len(sys.argv) > 1 and sys.argv[1] == 'debug'
factory = WampServerFactory("ws://localhost:9000", debugWamp = debug)
factory.protocol = PubSubServer1
factory.setProtocolOptions(allowHixie76 = True)
listenWS(factory)
webdir = File(".")
web = Site(webdir)
reactor.listenTCP(8080, web)
reactor.run()

You received this message because you are subscribed to a topic in the Google Groups “Autobahn” group.

To unsubscribe from this topic, visit https://groups.google.com/d/topic/autobahnws/AgC1IXFT3dE/unsubscribe.

To unsubscribe from this group and all its topics, send an email to autobahnws+...@googlegroups.com.

To post to this group, send email to autob...@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/autobahnws/85445a85-8467-4c37-943c-27b578e14e3f%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

0 Likes

#7

Just for the record. I installed my old version of Autobahn on my live server and it’s working great. So, thanks again, after the busy season I’ll look into what I’m missing out on with the new version.

···

On Wed, Sep 10, 2014 at 7:43 AM, Trendal Toews trenda...@gmail.com wrote:

Okay, maybe due to time constraints I’ll move my live server back to the old copy I have that is working and then after this season I’ll upgrade it all. It’s a seasonal web application. Used from September through October.

I really didn’t do enough research. My apologies, I’ll put it all back right when I get a chance. And I’ll get to see whats new and exciting to use for next year.

Thanks.

On Wed, Sep 10, 2014 at 7:38 AM, Alexander Gödde alexande...@googlemail.com wrote:

Hi Trendal,

yes, you’ll have to update Autobahn|JS as well. WAMP v2 changes quite a bit about the protocol, and is not compatible with any WAMP v1 libraries.

Unlike Autobahn|Python, there’s no support for both WAMP versions in any version of Autobahn|JS - it’s WAMP v1 up to 0.8.2, and WAMP v2 after that.

Regards,

Alex

Am Mittwoch, 10. September 2014 16:02:41 UTC+2 schrieb Trendal Toews:

Awesome. Thanks. Yeah I’ve had this copy of autobahn on my dev server for a long time. Never gave it a thought the version might have changed. On 14.04 I can find the python-autobahn package in the repos but I couldn’t seem to locate it for 12.04 so I just downloaded it and installed it manually. I was in too much of a hurry to think straight. I’ll figure out what version I have on the live server and get the code straightened out.

What about the Javascript client for the browsers then? I just used whatever package I had laying around on my dev server for my clients. Will I need to upgrade that as well when I move to the newer version?

My application isn’t built entirely on autobahn. I just use it to keep my clients in sync with a handle full of different topics. Clients post an empty message on what ever topic they have updated and the other clients then update their relevant data blocks. In the future I would like to start getting rid of the duplicate api requests from each client and just pass the data straight across the websocket.

Just looking now, I have 0.8.1 on my live server. I tried changing the import statement to autobahn.wamp1 but that didn’t to work. But I’ll get serious with it a little later today and make it work.

Thanks again.

On Tuesday, September 9, 2014 4:33:45 PM UTC-7, Trendal Toews wrote:

Hi,

I’m in a terrible pinch here. I have autobahn working flawlessly on my development server (ubuntu 14.04) and I needed to move it to the live server (12.04 ubuntu) today but it fails with a couple things I can’t figure out. I know this is nobody’s problem but mine, but this is supposed to be operating today.

When trying to run the code I get first a warning then an error

UserWarning: Module twisted was already imported from /usr/lib/python2.7/dist-packages/twisted/init.pyc, but /usr/local/lib/python2.7/dist-packages/autobahn-0.9.0-py2.7.egg is being added to sys.path

Traceback (most recent call last):

File “websocket_server.py”, line 10, in

from autobahn.websocket import listenWS

ImportError: cannot import name listenWS

Here is the code

#!/usr/bin/python

import sys

from twisted.python import log

from twisted.internet import reactor

from twisted.web.server import Site

from twisted.web.static import File

from autobahn.websocket import listenWS

from autobahn.wamp import WampServerFactory, \

  							WampServerProtocol

class PubSubServer1(WampServerProtocol):

def onSessionOpen(self):
  ## register a single, fixed URI as PubSub topic
  self.registerForPubSub("[http://test](http://test)")
  ## register a URI and all URIs having the string as prefix as PubSub topic
  self.registerForPubSub("[http://example.com/event#](http://example.com/event#)", True)

if name == ‘main’:

log.startLogging(sys.stdout)
debug = len(sys.argv) > 1 and sys.argv[1] == 'debug'
factory = WampServerFactory("ws://localhost:9000", debugWamp = debug)
factory.protocol = PubSubServer1
factory.setProtocolOptions(allowHixie76 = True)
listenWS(factory)
webdir = File(".")
web = Site(webdir)
reactor.listenTCP(8080, web)
reactor.run()

You received this message because you are subscribed to a topic in the Google Groups “Autobahn” group.

To unsubscribe from this topic, visit https://groups.google.com/d/topic/autobahnws/AgC1IXFT3dE/unsubscribe.

To unsubscribe from this group and all its topics, send an email to autobahnws+...@googlegroups.com.

To post to this group, send email to autob...@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/autobahnws/85445a85-8467-4c37-943c-27b578e14e3f%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

0 Likes