Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

windows support for non-blocking tailing #12

Open
sponsoredlinks opened this issue Feb 16, 2022 · 0 comments · May be fixed by sponsoredlinks/python-multitail2#1
Open

windows support for non-blocking tailing #12

sponsoredlinks opened this issue Feb 16, 2022 · 0 comments · May be fixed by sponsoredlinks/python-multitail2#1

Comments

@sponsoredlinks
Copy link

Thanks for the library, it's great. Just a small one for windows users getting the following, this can be fixed by removing the non-block flag in the os.open call. Not sure if there is a better way but this appears to fix the problem for me, and works for tailing multiple files

Patch:

import sys

is_windows = sys.platform == 'win32'
fh = os.fdopen(os.open(path, os.O_RDONLY | (0 if is_windows else os.O_NONBLOCK)))

Error:

Traceback (most recent call last):
File "userfile.py", line 6, in
mt = multitail2.MultiTail(glob_str)
File "C:\Python310\lib\site-packages\multitail2.py", line 152, in init
self._rescan(skip_to_end = skip_to_end)
File "C:\Python310\lib\site-packages\multitail2.py", line 177, in _rescan
self._tailedfiles[path] = TailedFile(path, skip_to_end = skip_to_end, offset = self._offsets.get(path, None))
File "C:\Python310\lib\site-packages\multitail2.py", line 16, in init
self._open(path, skip_to_end, offset)
File "C:\Python310\lib\site-packages\multitail2.py", line 30, in _open
fh = os.fdopen(os.open(path, os.O_RDONLY | os.O_NONBLOCK))
AttributeError: module 'os' has no attribute 'O_NONBLOCK'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant