Python Forum
[WxPython] PyPubSUb in Python 2.7 - Error - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: GUI (https://python-forum.io/forum-10.html)
+--- Thread: [WxPython] PyPubSUb in Python 2.7 - Error (/thread-12274.html)



PyPubSUb in Python 2.7 - Error - giu88 - Aug-17-2018

Hello,

Trying to use the PyPubSub library. When i import the library

from pubsub import pub
i get the following error:

Error:
getDefaultPublisher() -> Publisher: SyntaxError: Invalid syntax
Why can't i import the library? I am using Python 2.7, does it work with this version?

Thanks

Fixed!! Wxpython comes with the latest version of PyPubSub (version 4) which does not support Python 2.x.
Need to uninstall PyPubSub version 4

Output:
pip uninstall PyPubSub
and install version 3

Output:
pip install PyPubSub==3.3.0
The need to change

from pubsub import pub
to

from pubsub import pub as pub
I ahvetn't tested the whole functionality yet but at least i do't get the error anymore