I have a script that can convert a docx file to a json and I was wondering how can I detect if a file is empty. A solution I found is that one: https://thispointer.com/python-three-ways-to-check-if-a-file-is-empty/
Using:
- os.stat(file_path).st_size == 0:
- os.path.exists(file_path)
- os.path.getsize(path)
Unfortunately since an empty docx is not equal to 0. I can't use those methods. Any other solution?