File: python3.diff

package info (click to toggle)
python-libguess 1.1-1
  • links: PTS
  • area: main
  • in suites: buster, jessie, jessie-kfreebsd, stretch
  • size: 80 kB
  • ctags: 30
  • sloc: python: 171; makefile: 4
file content (39 lines) | stat: -rw-r--r-- 1,093 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
--- a/guess.py
+++ b/guess.py
@@ -75,10 +75,10 @@
 try:
     _LIBRARY_NAME = "libguess.so.1"
     _LIBRARY = ctypes.cdll.LoadLibrary(_LIBRARY_NAME)
-except AttributeError, e:
+except AttributeError as e:
     # TODO maybe support other other library types than .so?
     raise RuntimeError("Could not find standard C library loader. This system is not supported.")
-except OSError, e:
+except OSError as e:
     raise RuntimeError("""Could not find %s. Make sure that you have libguess installed and that it is compiled as dynamic library.""" % _LIBRARY_NAME)
 
 
@@ -197,19 +197,19 @@
     else:
         try:
             fp = open(source_file, "rb")
-        except IOError, e:
+        except IOError as e:
             sys.stderr.write(str(e) + "\n")
-            print ''
+            print('')
             return 3
 
     data = fp.read()
     fp.close()
     result = determine_encoding(data, region)
     if result is None:
-        print ''
+        print('')
         return 4
     else:
-        print result
+        print(result)
         return 0
 
 if __name__ == "__main__":