jlebon / textern

A Firefox add-on for editing text in your favourite external editor!
GNU General Public License v3.0
138 stars 21 forks source link

compat: new inotify_simple #57

Closed praiskup closed 4 years ago

praiskup commented 4 years ago

In new inotify_simple there's no inotify_simple/inotify_simple.py file, but only inotify_simple.py. So fix the import. This should be also compatible with previous versions of inotify_simple where they did from .inotify_simple import * inside __init__.py.

jlebon commented 4 years ago

Hmm, this doesn't work in the git submodule case:

stderr output from native app textern: Traceback (most recent call last):
stderr output from native app textern:   File "/home/jlebon/.local/libexec/textern/textern.py", line 17, in <module>
stderr output from native app textern:     from inotify_simple import INotify, flags
stderr output from native app textern: ImportError: cannot import name 'INotify' from 'inotify_simple' (unknown location)

I think because the actual inotify_simple Python module is nested.

Probably easiest thing to do is to check if the inotify_simple directory exists where the script is and add it to sys.path if so?

praiskup commented 4 years ago

Probably easiest thing to do is to check if the inotify_simple directory exists where the script is and add it to sys.path if so?

Maybe even easier is to fallback to import the old pattern. But feel free to enhance the import pattern in git-submodule use-case. That does probably something unexpected.

praiskup commented 4 years ago

iow, pr updated