rossem / RedditStorage

Store files onto reddit subreddits.
832 stars 31 forks source link

AttributeError: 'module' object has no attribute 'subscribe' #7

Closed SanketDG closed 9 years ago

SanketDG commented 9 years ago

I installed wxPython from the software repositories, and I checked the version it was 2.8. Then when I started it gave me the following error message

:0: UserWarning: The keyword `bot` in your user_agent may be problematic.
Traceback (most recent call last):
  File "RedditStorage.py", line 477, in <module>
    MainWindow(None, title='subreddit')
  File "RedditStorage.py", line 398, in __init__
    notebook = MainNotebook(panel)
  File "RedditStorage.py", line 365, in __init__
    self.InitUI()
  File "RedditStorage.py", line 371, in InitUI
    tabTwo = GetPanel(self)
  File "RedditStorage.py", line 225, in __init__
    pub.subscribe(self.fileListener, "fileListener")
AttributeError: 'module' object has no attribute 'subscribe'

I tried importing pub from the python interpreter as

from wx.lib.pubsub import pub

and it did import, but there was indeed no subscribe module, it gave me an AttributeError.

I looked through the documentation and found this page: pubsub

By following the instructions there, I could easily change the code and make everything work. The change is just two lines of code as follows,

from wx.lib.pubsub import Publisher
pub = Publisher()

This change should work.

Also, why am I having this problem? Is my version too old? Do I need to upgrade 3.0? I can submit a pull request if this is a real issue and not just a problem with my machine.

rossem commented 9 years ago

Yeah, I think you need to get the new wxPython version.

When I did pip freeze I got:

wxPython==3.0.2.0
wxPython-common==3.0.2.0

Hope this helps.

jameswang14 commented 9 years ago

I'm using wxPython ver 3.0.2 as well; try updating and see if that fixes it.

SanketDG commented 9 years ago

Yeah works flawlessly in version 3.0.0. You can now close this.