Kept the existing safe behavior intact: paths are only added if they exist and are not already in sys.path, so this broadens compatibility without duplicating entries.
existing sibling fallback (../python)
direct fallback (libdir/python)
AppImage-aware fallbacks under $APPDIR/usr/lib/zoitechat/python and $APPDIR/usr/lib/x86_64-linux-gnu/zoitechat/python.
Added guards so paths are appended only if the directory exists and is not already in sys.path, reducing duplicate/invalid entries while improving robustness across packaging layouts.
The python plugin use weak references for hooks, which might let a
necessary object disappear if the callback of a timer hook unhooks
itself.
Signed-off-by: Celelibi <celelibi@gmail.com>
Python sometime calls flush() on sys.stdout or sys.stderr.
In particular, it might do so when an exception is raised. This fixes
the second error message that was generated in such cases.
Signed-off-by: Celelibi <celelibi@gmail.com>
* Make sure `help()` doesn't cause hexchat to hang
Replace `pydoc.help` with a copy of `pydoc.Helper` with an empty
`StringIO` instead of stdin
* Handle BytesIO vs StringIO on 2.7