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

Python3 compatibility #3

Open
getzze opened this issue Mar 13, 2015 · 11 comments
Open

Python3 compatibility #3

getzze opened this issue Mar 13, 2015 · 11 comments

Comments

@getzze
Copy link
Owner

getzze commented Mar 13, 2015

Check with python3 and python2

@szepeviktor
Copy link

Works for both 2 and 3

try:
    return isinstance(obj, basestring)
except NameError:
    return isinstance(obj, str)

@szepeviktor
Copy link

@szepeviktor
Copy link

import lockfile.pidlockfile then lockfile.pidlockfile.AlreadyLocked and lockfile.pidlockfile.PIDLockFile(path)
https://github.com/openstack/pylockfile

@szepeviktor
Copy link

Typo: gid and uid **tu** run the daemon.

@getzze
Copy link
Owner Author

getzze commented Jun 1, 2015

What is the problem of opening the files for stdin, stdout and stderr not in binary?
Normally the daemon module supports non-binary files, see https://pypi.python.org/pypi/python-daemon/ and https://www.python.org/dev/peps/pep-3143/#daemoncontext-objects

Also, can you make pull request instead of comments? It is easier to comment the changes then and to accept them.
Thanks

@szepeviktor
Copy link

I've added binary open()-s because python 3.4 told me:

Traceback (most recent call last):
  File "watcher.py", line 500, in <module>
    daemon = DaemonRunner(watcher, **options)
  File "watcher.py", line 69, in __init__
    self.daemon_context.stderr = open(stderr or '/dev/null', 'w+', buffering=0)
ValueError: can't have unbuffered text I/O

Then I've googled.

@szepeviktor
Copy link

I cannot fork your repo because I end up in splitbrain's one.
szepeviktor/Watcher@23a1e00
In a patch:
https://github.com/szepeviktor/Watcher/commit/23a1e006cbe0ac8a038a135ee6e02397fe6d8547.patch

@getzze
Copy link
Owner Author

getzze commented Jun 1, 2015

Did you try git clone https://github.com/getzze/Watcher ?
Indeed, in python 3, unbuffered files can only be used in binary mode. I suspect this will lead to encoding errors, but the redirection of stdin, stdout and stderr is not implemented in watcher anyway.

@szepeviktor
Copy link

Cloning works but I cannot fork two repos being forks of each other.

@szepeviktor
Copy link

Please make those changes for lockfile, it had API changes.

@szepeviktor
Copy link

I think stdin and sdtout also need to have b.

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

No branches or pull requests

2 participants