seb-m / pyinotify

Monitoring filesystems events with inotify on Linux.
http://github.com/seb-m/pyinotify/wiki
MIT License
2.29k stars 379 forks source link

import error with python-3.8.1 involving pyinotify.cpython-38.pyc #185

Open agouaux opened 4 years ago

agouaux commented 4 years ago

After installing this module into python-3.8.1, when I try to import it, I get the following error:

$ python -m pyinotify -v /tmp
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/runpy.py", line 184, in _run_module_as_main
    mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
  File "/usr/local/lib/python3.8/runpy.py", line 154, in _get_module_details
    code = loader.get_code(mod_name)
  File "<frozen importlib._bootstrap_external>", line 911, in get_code
  File "<frozen importlib._bootstrap_external>", line 580, in _compile_bytecode
ValueError: bad marshal data (unknown type code)

$ python --version
Python 3.8.1

However, after I delete the following file, it works.

# rm -f /usr/local/lib/python3.8/site-packages/__pycache__/pyinotify.cpython-38.pyc

$ python -m pyinotify -v /tmp
[2020-03-21 13:14:56,596 pyinotify DEBUG] Start monitoring ['/tmp'], (press c^c to halt pyinotify)
[2020-03-21 13:14:56,606 pyinotify DEBUG] New <Watch wd=1 path=/tmp mask=4095 proc_fun=None auto_add=None exclude_filter=<function WatchManager.<lambda> at 0x7f65bfb373a0> dir=True >
^C[2020-03-21 13:15:01,222 pyinotify DEBUG] Pyinotify stops monitoring.