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

Docker issue with pushbullet (mqttwarn-full) #675

Closed
DNicholai opened this issue May 21, 2023 · 8 comments
Closed

Docker issue with pushbullet (mqttwarn-full) #675

DNicholai opened this issue May 21, 2023 · 8 comments
Labels
bug service plugin All about service plugins

Comments

@DNicholai
Copy link

DNicholai commented May 21, 2023

I'm having an issue with the pushbullet plugin running on docker - I'm using the full version with all plugins.

Docker version is : 19.03.15, build 99e3ed8919

I'm launching docker using the following command:

sudo docker run -it --rm --volume=$PWD:/etc/mqttwarn --volume=$PWD/log:/log ghcr.io/mqtt-tools/mqttwarn-full:latest 

And the output from terminal is as follows:

2023-05-21 18:09:32,292 INFO     [mqttwarn.commands         ] Starting mqttwarn
2023-05-21 18:09:32,293 INFO     [mqttwarn.commands         ] Log level is DEBUG
2023-05-21 18:09:32,294 DEBUG    [mqttwarn.core             ] Trying to load built-in service "file" from "file"
2023-05-21 18:09:32,296 DEBUG    [mqttwarn.core             ] Trying to load service "file" from file "/usr/local/lib/python3.11/site-packages/mqttwarn/services/file.py"
2023-05-21 18:09:32,297 INFO     [mqttwarn.core             ] Successfully loaded service "file"
2023-05-21 18:09:32,298 DEBUG    [mqttwarn.core             ] Trying to load built-in service "log" from "log"
2023-05-21 18:09:32,299 DEBUG    [mqttwarn.core             ] Trying to load service "log" from file "/usr/local/lib/python3.11/site-packages/mqttwarn/services/log.py"
2023-05-21 18:09:32,300 INFO     [mqttwarn.core             ] Successfully loaded service "log"
2023-05-21 18:09:32,301 DEBUG    [mqttwarn.core             ] Trying to load built-in service "pushbullet" from "pushbullet"
2023-05-21 18:09:32,302 DEBUG    [mqttwarn.core             ] Trying to load service "pushbullet" from file "/usr/local/lib/python3.11/site-packages/mqttwarn/services/pushbullet.py"
2023-05-21 18:09:32,307 ERROR    [mqttwarn.core             ] Loading service "pushbullet" from file "/usr/local/lib/python3.11/site-packages/mqttwarn/services/pushbullet.py" failed
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/mqttwarn/core.py", line 603, in load_services
    service_plugins[service]["module"] = load_module_from_file(modulefile)
                                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/mqttwarn/util.py", line 138, in load_module_from_file
    return imp.load_source(digest, path, fp)  # type: ignore[arg-type]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/imp.py", line 172, in load_source
    module = _load(spec)
             ^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 721, in _load
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/usr/local/lib/python3.11/site-packages/mqttwarn/services/pushbullet.py", line 8, in <module>
    from pushbullet.pushbullet import PushBullet
  File "/usr/local/lib/python3.11/site-packages/pushbullet/pushbullet.py", line 36, in <module>
    from urlparse import urljoin
ModuleNotFoundError: No module named 'urlparse'
2023-05-21 18:09:32,315 CRITICAL [mqttwarn.core             ] Unable to load service "pushbullet"
@amotl
Copy link
Member

amotl commented May 21, 2023

Dear David,

thanks for reporting this flaw. The error you are demonstrating indicates that the Pushbullet module for mqttwarn might not have been made ready for Python 3 yet. We will have to improve that.

With kind regards,
Andreas.

@DNicholai
Copy link
Author

Dear Andreas,

Thank you for your quick and informed reply.

I am upgrading the docker version in the hopes that it might bring some (admittedly unexpected) benefit.

In the meantime I'll happily continue using my non-docker based install of mqttwarn which still works great :)

Cdt,
David

@amotl
Copy link
Member

amotl commented May 22, 2023

Hi again,

I've just verified that the underlying PushbulletPythonLibrary package does not support Python 3.

pip install PushbulletPythonLibrary
>>> import pushbullet.pushbullet
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/amo/dev/daq-tools/sources/mqttwarn/.venv311/lib/python3.11/site-packages/pushbullet/pushbullet.py", line 36, in <module>
    from urlparse import urljoin
ModuleNotFoundError: No module named 'urlparse'

In the meantime I'll happily continue using my non-docker based install of mqttwarn which still works great.

Excellent. May I ask if you are still using this in a Python 2 environment - like, what does python -V say?

$ python -V
Python 2.7.16

With kind regards,
Andreas.

@amotl
Copy link
Member

amotl commented May 22, 2023

It will make sense to switch to a more modern client wrapper library, like one of those:

@DNicholai
Copy link
Author

DNicholai commented May 22, 2023

Hello again.

Python on the working install (hasn't been updated in a while) is running the following version :

Python 2.7.9

@amotl
Copy link
Member

amotl commented May 23, 2023

Dear David,

GH-676 will fix the problem by modernizing the Pushbullet service plugin. Major improvements are:

a) Works now with Python 3.
b) Will not need any external dependencies, thus will be available through OCI image mqttwarn-standard.
c) Now obtains a modern target address descriptor, based on a dictionary instead of a list, see GH-628. 1

You will find corresponding examples how to install the preview version within the PR description. We will be happy about corresponding feedback, if that works for you or not.

With kind regards,
Andreas.

Footnotes

  1. Please note this change retains backwards-compatibility to the previous configuration style, so you should be able to re-use your existing configuration 1:1. However, we encourage to use the modern configuration style, like outlined in the updated documentation.

@DNicholai
Copy link
Author

Dear Andreas,

As mentioned in GH-676 -- confirmed as working, thanks so much ^^

Best regards,
David

@amotl
Copy link
Member

amotl commented Oct 14, 2023

mqttwarn 0.35.0 has been released, including this fix, so I am closing this ticket.

@amotl amotl closed this as completed Oct 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug service plugin All about service plugins
Projects
None yet
Development

No branches or pull requests

2 participants