0

the code gives error when I try to open directory as I want it to open the files within the directories however I am getting below error.

    with open(i, 'rb') as f:
IsADirectoryError: [Errno 21] Is a directory: 'hard_signatures'
    for i in SHA256_HASHES_pack1:
            with open(i, 'rb') as f:
                md5 = hashlib.md5()
                sha1 = hashlib.sha1()
                while True:
                    data = f.read(BUF_SIZE)
                    md5.update(data)
                    sha1.update(data)
                    if not data:
1
  • Could you post the text in SHA256_HASHES_pack1? Commented Jul 18, 2022 at 15:18

1 Answer 1

1

That open function opens a file, not a directory. See https://www.w3schools.com/python/ref_func_open.asp

If you want to cycle through all files in directory i see How can I iterate over files in a given directory?

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.