nolze / msoffcrypto-tool

Python tool and library for decrypting and encrypting MS Office files using passwords or other keys
https://msoffcrypto-tool.readthedocs.io/
MIT License
556 stars 89 forks source link

AttributeError: '00XMLFile' object has no attribute 'is_encrypted' in Python 3.12 #94

Open sandeepsandeepnr opened 1 month ago

sandeepsandeepnr commented 1 month ago

Issue: After updating to Python 3.12, I encountered an AttributeError when trying to use the is_encrypted() method with msoffcrypto-tool version 4.4.0. The object returned was of type 00XMLFile, which does not seem to support the is_encrypted() method.

Error: AttributeError: '00XMLFile' object has no attribute 'is_encrypted

Code:

import msoffcrypto

try: with open(encrypted, 'rb') as f: file = msoffcrypto.OfficeFile(f) print(type(file)) # Check if this is the correct object print(file.is_encrypted()) # Try checking encryption except Exception as e: print(f"Error: {e}")

nolze commented 1 month ago

Thank you for reporting! Could you try it again after updating to the latest version (v5.4.2)?

pip install -U msoffcrypto-tool