pefile.PEFormatError: 'DOS Header magic not found.'
NilanjPatel opened this issue · comments
This is the code :
res = {} ; pe = pefile.PE(fpath) ; res['Machine'] = pe.FILE_HEADER.Machine
the file is a zip or a text file which I am giving as input.
Traceback (most recent call last): File "main.py", line 196, in <module> data = extract_infos(args.FILE) File "main.py", line 74, in extract_infos pe = pefile.PE(fpath) File "/opt/anaconda3/lib/python3.8/site-packages/pefile.py", line 1754, in __init__ self.__parse__(name, data, fast_load) File "/opt/anaconda3/lib/python3.8/site-packages/pefile.py", line 1847, in __parse__ raise PEFormatError('DOS Header magic not found.') pefile.PEFormatError: 'DOS Header magic not found.'
I think this is an expected result for a file without a proper DOS header. Do you expect something different?
@insolor yes, I got this. Can you help me to read file details like features of file and other information like MajorLinkerVersion, etc. which works in mac, Linux and windows os.
@NilanjPatel I can, but I won't. Try to consult with the PE Header specification from Microsoft and try to retrieve necessary information using pefile in some interactive environments with autocompletion (some IDE or REPL like IPython).