Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError on multiple submodule #269

Open
MayukhSobo opened this issue Jul 30, 2018 · 13 comments
Open

AttributeError on multiple submodule #269

MayukhSobo opened this issue Jul 30, 2018 · 13 comments

Comments

@MayukhSobo
Copy link

I am getting AttributeError on multiple imports specially the imports like

  • logbook.notifiers
  • logbook.more

image

image

I went ahead checking your __init__.py file and didn't see any entry for these modules

@vmalloc
Copy link
Collaborator

vmalloc commented Jul 30, 2018

The good practice is to import those if you need them. It is not a guarantee in Python packaging that a package should import all its sub-packages in its toplevel namespace...

@vmalloc
Copy link
Collaborator

vmalloc commented Jul 30, 2018

Just to be clear - that means that in your code you should:

from logbook.notifiers import ...

or

from logbook import notifiers

@MayukhSobo
Copy link
Author

Sorry for a little delayed response but I can import it after restarting my system. But now I am getting the following error

Traceback (most recent call last):
  File "/Users/mayukhsarkar/Documents/Codes/ACE/venv/lib/python3.6/site-packages/logbook/notifiers.py", line 75, in __init__
    import Growl
ModuleNotFoundError: No module named 'Growl'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/mayukhsarkar/Library/Preferences/PyCharmCE2018.2/scratches/scratch.py", line 3, in <module>
    create_notification_handler()
  File "/Users/mayukhsarkar/Documents/Codes/ACE/venv/lib/python3.6/site-packages/logbook/notifiers.py", line 33, in create_notification_handler
    return GrowlHandler(application_name, level=level, icon=icon)
  File "/Users/mayukhsarkar/Documents/Codes/ACE/venv/lib/python3.6/site-packages/logbook/notifiers.py", line 78, in __init__
    raise RuntimeError('The growl module is not available.  You have '
RuntimeError: The growl module is not available.  You have to install either growl-py or py-Growl to use the GrowlHandler.

@vmalloc
Copy link
Collaborator

vmalloc commented Jul 31, 2018

@MayukhSobo IIRC the notifiers module is intended for cases where you have Growl installed...

@MayukhSobo
Copy link
Author

@vmalloc Yes but two things here.

First, installing Logbook should have installed all its dependencies which it didn't
Second, I did pip install Growl but it is not working after that too.

@vmalloc
Copy link
Collaborator

vmalloc commented Aug 1, 2018

Growl is not a dependency of Logbook. It doesn't make sense forcing such an unrelated package by default. The right thing is to use extras, and that we should probably do. Until then the right thing to do is include Growl in your own requirements if you require it. Logbook should work with or without it until it requires a feature provided by it.

Secondly, it's strange that pip install Growl doesn't solve it... Are you able to import the required module manually after installing it?

@MayukhSobo
Copy link
Author

No I am not able to do it..Have a look
image

image

@vmalloc
Copy link
Collaborator

vmalloc commented Aug 2, 2018

Yup, this seems broken... I don't think it ever worked :-(

If you can provide a PR that fixes it that would be very welcome.

@MayukhSobo
Copy link
Author

Okay....I seemed to have figured out the problem..

@vmalloc
Copy link
Collaborator

vmalloc commented Aug 2, 2018

@MayukhSobo what is it? I don't see how that import can work in today's Growl...

@MayukhSobo
Copy link
Author

MayukhSobo commented Aug 2, 2018

Actually can you point out where did you see the growl package? If it is this link then the problem is that it has to be installed and imported with growl with small g...I did that and now it is giving me a different error, but at least not Module Not found.

PS: Please mention if you have user some other package. This seems to the most updated growl for MacOS but I will have to test it. Please close this issue and open a new one..

@vmalloc
Copy link
Collaborator

vmalloc commented Aug 4, 2018

Yes the problem is the code is attempting to import a name not provided by the specific package known as Growl. This could be a historic mistake or a breakage on behalf of the folks maintaining Growl, as this is very old and not very widely used apparently...

@MayukhSobo
Copy link
Author

I was wondering if you can move to a better notification system as the current one using Growl is pretty old and requires a paid Growl service.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants