Error Messages
Ce contenu n’est pas encore disponible dans votre langue.
Introduction
Section titled “Introduction”Frequently identified error messages can be recorded in this section
RuntimeError: asyncio.run() cannot be called from a running event loop
Section titled “RuntimeError: asyncio.run() cannot be called from a running event loop”If your calling program runs it’s own event loop, then Apprise can cause some commotion when it tries to work with it’s own. For these circumstances you have 2 options:
-
Do not call
notify(). Insteadawaittheasync_notify()call itself. See here for more details. -
Leverage a library that handles this exact case called nest-asyncio:
Terminal window pip3 install nest-asyncioThen from within your python application just import it at the top:
import nest_asyncio# apply itnest_asyncio.apply()An issue related to FastCGI was brought forth here and solved using this method.
Pyinstaller Handling
Section titled “Pyinstaller Handling”Pyinstaller allows to package a python application with its dependencies in a single exe.
It is possible to package an application that is using Apprise but there is a trick.
Let’s take a simple script:
import appriseapobj = apprise.Apprise()apobj.add('<SCHEME>://<FQDN>/<TOKEN>')apobj.notify(title="a title", body="this is the body of the notification")Then package with pytinstaller:
pyinstaller -F myscript.pyAnd launch it:
./dist/myscriptWe get:
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/_MEIEbGkgo/apprise/attachment'orFileNotFoundError: [Errno 2] No such file or directory: '/tmp/_MEIEbGkgo/apprise/plugins'orFileNotFoundError: [Errno 2] No such file or directory: '/tmp/_MEIEbGkgo/apprise/config'We have to use --collect-all option which, according to documentation:
Collect all submodules, data files, and binaries from the specified package or module. This option can be used multiple times.
pyinstaller -F --collect-all apprise myscript.pyNo more errors, notifications are sent.