[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [ooni-probe/master] Use errno instead of integer to detect if file already exists



commit 1952ca0f1d55d8b78a1bed22c150bdfaf288b94e
Author: Arturo Filastò <arturo@xxxxxxxxxxx>
Date:   Thu Sep 1 17:30:45 2016 +0200

    Use errno instead of integer to detect if file already exists
---
 ooni/settings.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/ooni/settings.py b/ooni/settings.py
index 065252b..a0ef0a5 100644
--- a/ooni/settings.py
+++ b/ooni/settings.py
@@ -1,6 +1,7 @@
 import os
 import sys
 import yaml
+import errno
 import getpass
 from ConfigParser import SafeConfigParser
 
@@ -332,7 +333,7 @@ class OConfig(object):
             try:
                 os.makedirs(path)
             except OSError as exc:
-                if exc.errno != 17:
+                if exc.errno != errno.EEXIST:
                     raise
 
     def create_config_file(self, include_ip=False, include_asn=True,



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits