Created
July 24, 2012 14:21
-
-
Save wiiaboo/3170174 to your computer and use it in GitHub Desktop.
Fix import exceptions to work with Python 3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/animecheck.py b/animecheck.py | |
index b0e461e..03c74c8 100755 | |
--- a/animecheck.py | |
+++ b/animecheck.py | |
@@ -32,7 +32,11 @@ There is NO WARRANTY, to the extent permitted by law. | |
''' | |
import codecs | |
-import exceptions | |
+# Python 3 doesn't have an exceptions module | |
+try: | |
+ from exceptions import IOError | |
+except: | |
+ pass | |
import hashlib | |
import io | |
import os | |
@@ -725,7 +729,7 @@ def currentHashingTask_error(e): | |
global currentHashingTask | |
# Dealing with various errors | |
- if isinstance(e, exceptions.IOError) and e.errno == 2: | |
+ if isinstance(e, IOError) and e.errno == 2: | |
# File not found error | |
currentHashingTask['errorFileNotFoundCount'] += 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment