From 3e281ee2b7cf208734ae676271e3a41ec8667f4f Mon Sep 17 00:00:00 2001 From: Chris Caron Date: Wed, 6 Jul 2022 09:00:48 -0400 Subject: [PATCH] Updated Troubleshooting (markdown) --- Troubleshooting.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/Troubleshooting.md b/Troubleshooting.md index 3a1b0db..20a4762 100644 --- a/Troubleshooting.md +++ b/Troubleshooting.md @@ -8,6 +8,9 @@ * [Special Characters and URL Conflicts](#special-characters-and-url-conflicts) * [Formatting Issues](#formatting-issues) * [PyInstaller Support](#pyinstaller-support) + * [General Exceptions and/or Messages](#general-exceptions-andor-messages) + * [RuntimeError: asyncio.run() cannot be called from a running event loop +](https://github.com/caronc/apprise/wiki/Troubleshooting/_edit#runtimeerror-asynciorun-cannot-be-called-from-a-running-event-loop) ## General Troubleshooting @@ -233,3 +236,21 @@ pyinstaller -F --collect-all apprise myscript.py No more errors, notifications are sent. +## General Exceptions and/or Messages + +### 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. +1. Do not call `notify()`. Instead `await` the `async_notify()` call itself. [See here for more details](https://github.com/caronc/apprise/wiki/Development_API#async_notify--leveraging-await-to-send-notifications). +1. Leverage a library that handles this exact case called [nest-asyncio](https://pypi.org/project/nest-asyncio/): + ```bash + pip install nest-asyncio + ``` + Then from within your python application just import it at the top: + ```python + import nest_asyncio + # apply it + nest_asyncio.apply() + ``` + + An issue related to FastCGI was brought forth [here](https://github.com/caronc/apprise/issues/610) and solved using this method. +