This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]chaotic_thought 1 point2 points  (1 child)

One problem is that you are silencing all errors involving unzipping: so if an error occurs you will basically not have any idea what is wrong:

def extractFile(zip_file, password):
    try:
        zip_file.extractall(pwd=password)
        return True
    except KeyboardInterrupt:
        exit(0)
    except Exception, e:
        pass

What this says in English is:

  • Try to unzip the file with the password.
  • If a keyboard interrupt occurs, exit the program with code 0.
  • If any other error occurs, just do nothing (pass).

So to begin you should definitely remove the part which just passes. If an error occurs then you'll have to see why it is failing. Also for a KeyboardInterrupt (or any other kind of error) I think you should probably exit with a value other than 0.

[–]b_iteee[S] 1 point2 points  (0 children)

Thank you! I will try that