Skip to content
This repository has been archived by the owner on Jul 15, 2021. It is now read-only.

Problem with sending notifications #103

Closed
michael-markl opened this issue Jan 20, 2021 · 2 comments
Closed

Problem with sending notifications #103

michael-markl opened this issue Jan 20, 2021 · 2 comments

Comments

@michael-markl
Copy link

Hey there! Thanks for your script.

I have the problem, that after starting up and selecting my target graphics card (3070 in my case), I get the following error message:

2021-01-20 20:05:54 INFO: Sending started notification to apprise-1...
Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/lib/python3.6/threading.py", line 916, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.6/threading.py", line 864, in run
    self._target(*self._args, **self._kwargs)
  File "/home/michael/git/nvidia-sniper/sniper/notifications.py", line 41, in worker
    self.send_notifications(notification_type)
  File "/home/michael/git/nvidia-sniper/sniper/notifications.py", line 36, in send_notifications
    apobj.notify(title=title, body=msg)
  File "/home/michael/git/nvidia-sniper/venv/lib/python3.6/site-packages/apprise/Apprise.py", line 442, in notify
    if not py3compat.asyncio.notify(coroutines, debug=self.debug):
  File "/home/michael/git/nvidia-sniper/venv/lib/python3.6/site-packages/apprise/py3compat/asyncio.py", line 79, in notify
    loop = asyncio.get_event_loop()
  File "/usr/lib/python3.6/asyncio/events.py", line 694, in get_event_loop
    return get_event_loop_policy().get_event_loop()
  File "/usr/lib/python3.6/asyncio/events.py", line 602, in get_event_loop
    % threading.current_thread().name)
RuntimeError: There is no current event loop in thread 'Thread-1'.

/usr/lib/python3.6/threading.py:949: RuntimeWarning: coroutine 'AsyncNotifyBase.async_notify' was never awaited
  del exc_type, exc_value, exc_tb

I use a telegram bot. The corresponding section of notifcations.json
"services": { "apprise-1": { "url": "tgram://abc:xyz/chatid", "screenshot": false } }
where abc:xyz is the bot token and chatid is the target chatid. Using the sample

curl -X POST "https://api.telegram.org/botabc:xyz/sendMessage" -d "chat_id=chatid&text=my sample text"

does work!

Can you help here?

@caronc
Copy link

caronc commented Feb 22, 2021

This error is on me. I've added some bulletproofing into Apprise to handle this situation better. I'll bundle up a new release soon. In the meantime if you just updated your local copy of apprise in whatever container/environment you're using this nvidia-sniper in with what is in the master branch, your problem will go away:

# Install the master branch which includes this fix
pip install git+https://github.com/caronc/apprise

@caronc
Copy link

caronc commented Mar 8, 2021

This is now fixed in the official version of Apprise. 👍

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

No branches or pull requests

2 participants