eagleflo / mpyq

Python library for reading MPQ archives.
BSD 2-Clause "Simplified" License
100 stars 23 forks source link

Properly write empty files to disk. #17

Closed GraylinKim closed 11 years ago

GraylinKim commented 11 years ago

Sometime the MPQ file listing will include files for which there is no data (example). In these cases, read_file returns None and extract_to_disk fails with a type error:

Traceback (most recent call last):
  File "/home/graylinkim/projects/sc2reader/env/bin/mpyq", line 8, in <module>
    load_entry_point('mpyq==0.2.0', 'console_scripts', 'mpyq')()
  File "build/bdist.linux-x86_64/egg/mpyq.py", line 402, in main
  File "build/bdist.linux-x86_64/egg/mpyq.py", line 254, in extract_to_disk
TypeError: must be string or buffer, not None

We can just substitute an empty string for None when writing to disk.

eagleflo commented 11 years ago

Thank you for the fix!

eagleflo commented 11 years ago

I'm going to release 0.2.1 with this and one other fix included soon.

GraylinKim commented 11 years ago

Great, thanks.

eagleflo commented 11 years ago

I released 0.2.1 yesterday with the fixes.