klemens-u / nextcloud-inotify

When a file is created/changed/deleted in the filesystem (e.g. over Samba) run Nextcloud file scanning for the parent directory efficently. Otherwise the updates would not be recognized by Nextcloud
1 stars 0 forks source link

The asyncore module is deprecated in python version 3.12 #3

Open janusn opened 1 week ago

janusn commented 1 week ago

The following snip was found on a log of nextcloud container:

[custom-init] Files found, executing
[custom-init] install-nextcloud-inotify: executing...
apk updating...
fetch http://dl-cdn.alpinelinux.org/alpine/v3.20/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.20/community/x86_64/APKINDEX.tar.gz
v3.20.1-59-g0a6de68fa41 [http://dl-cdn.alpinelinux.org/alpine/v3.20/main]
v3.20.1-62-gfb112888f77 [http://dl-cdn.alpinelinux.org/alpine/v3.20/community]
OK: 24196 distinct packages available

apk updated.
apk adding py3-inotify...
OK: 360 MiB in 323 packages
apk added py3-inotify.
fetching watcher.py...
Connecting to raw.githubusercontent.com (185.199.110.133:443)
saving to '/usr/local/bin/watcher.py'
watcher.py           100% |********************************| 13805  0:00:00 ETA
'/usr/local/bin/watcher.py' saved
fetched watcher.py.
chmod watcher*
rm: cannot remove '/tmp/watcher.pid': No such file or directory
starting watcher.py...
Traceback (most recent call last):
  File "/usr/local/bin/watcher.py", line 44, in <module>
    import pyinotify
  File "/usr/lib/python3.12/site-packages/pyinotify.py", line 71, in <module>
    import asyncore
ModuleNotFoundError: No module named 'asyncore'
started watcher.py.
[custom-init] install-nextcloud-inotify: exited 0
[ls.io-init] done.

According to the official python doc, asyncore is deprecated in python 3.12.

Environment:

janusn commented 1 week ago

I have fixed the problem by replacing the required file pyinotify.py with a branch of pyinotify written by Elephant Liu.