From 74d147a0bef5fd3b90307269c295b54ebdcbd861 Mon Sep 17 00:00:00 2001 From: ZyX Date: Sat, 23 Aug 2014 03:55:37 +0400 Subject: [PATCH] Use `open` to open file descriptors in place of `file` Reason: there is no `file()` in Python 3. Fix was originally presented by @kovidgoyal in [3deb69][1], but I cannot cherry-pick this commit, because its commit message is highly undescriptive. Fixes #1008 [1]: https://github.com/kovidgoyal/powerline-daemon/commit/3deb6988c8992d92ef43d9f03c7a725ac9836c20 --- scripts/powerline-daemon | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/powerline-daemon b/scripts/powerline-daemon index 20794575..4a8ffb9b 100755 --- a/scripts/powerline-daemon +++ b/scripts/powerline-daemon @@ -274,9 +274,9 @@ def daemonize(stdin=os.devnull, stdout=os.devnull, stderr=os.devnull): sys.exit(1) # Redirect standard file descriptors. - si = file(stdin, 'r') - so = file(stdout, 'a+') - se = file(stderr, 'a+', 0) + si = open(stdin, 'rb') + so = open(stdout, 'a+b') + se = open(stderr, 'a+b', 0) os.dup2(si.fileno(), sys.stdin.fileno()) os.dup2(so.fileno(), sys.stdout.fileno()) os.dup2(se.fileno(), sys.stderr.fileno())