From 3914d76287ce75156c0f1436e7311e01c975c655 Mon Sep 17 00:00:00 2001 From: Florent Date: Tue, 8 Sep 2015 08:43:04 +0200 Subject: [PATCH] s/dev\/null/os.devnull + add binary flag For windows compatibility --- contrib/downloadboob/downloadboob.py | 2 +- weboob/applications/cineoob/cineoob.py | 2 +- weboob/applications/galleroob/galleroob.py | 2 +- weboob/applications/radioob/radioob.py | 2 +- weboob/applications/videoob/videoob.py | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/contrib/downloadboob/downloadboob.py b/contrib/downloadboob/downloadboob.py index fe7a5268..644a0792 100755 --- a/contrib/downloadboob/downloadboob.py +++ b/contrib/downloadboob/downloadboob.py @@ -192,7 +192,7 @@ class Downloadboob(object): return 4 def check_exec(executable): - with open('/dev/null', 'w') as devnull: + with open(os.devnull, 'w') as devnull: process = subprocess.Popen(['which', executable], stdout=devnull) if process.wait() != 0: print('Please install "%s"' % executable, file=sys.stderr) diff --git a/weboob/applications/cineoob/cineoob.py b/weboob/applications/cineoob/cineoob.py index d1da3cdd..49ca3954 100644 --- a/weboob/applications/cineoob/cineoob.py +++ b/weboob/applications/cineoob/cineoob.py @@ -503,7 +503,7 @@ class Cineoob(ReplApplication): print(buf) else: try: - with open(dest, 'w') as f: + with open(dest, 'wb') as f: f.write(buf) except IOError as e: print('Unable to write .torrent in "%s": %s' % (dest, e), file=self.stderr) diff --git a/weboob/applications/galleroob/galleroob.py b/weboob/applications/galleroob/galleroob.py index 752b9ad7..5772e898 100644 --- a/weboob/applications/galleroob/galleroob.py +++ b/weboob/applications/galleroob/galleroob.py @@ -133,7 +133,7 @@ class Galleroob(ReplApplication): name = '%03d.%s' % (i, ext) print('Writing file %s' % name) - with open(name, 'w') as f: + with open(name, 'wb') as f: f.write(img.data) os.chdir(os.path.pardir) diff --git a/weboob/applications/radioob/radioob.py b/weboob/applications/radioob/radioob.py index 87695658..9efd5218 100644 --- a/weboob/applications/radioob/radioob.py +++ b/weboob/applications/radioob/radioob.py @@ -199,7 +199,7 @@ class Radioob(ReplApplication): audio.url = _obj.url def check_exec(executable): - with open('/dev/null', 'w') as devnull: + with open(os.devnull, 'w') as devnull: process = subprocess.Popen(['which', executable], stdout=devnull) if process.wait() != 0: print('Please install "%s"' % executable, file=self.stderr) diff --git a/weboob/applications/videoob/videoob.py b/weboob/applications/videoob/videoob.py index 7b3e8c5b..35874223 100644 --- a/weboob/applications/videoob/videoob.py +++ b/weboob/applications/videoob/videoob.py @@ -81,7 +81,7 @@ class Videoob(ReplApplication): return 4 def check_exec(executable): - with open('/dev/null', 'w') as devnull: + with open(os.devnull, 'w') as devnull: process = subprocess.Popen(['which', executable], stdout=devnull) if process.wait() != 0: print('Please install "%s"' % executable, file=self.stderr)