Skip to content

Commit 6e5f593

Browse files
committed
Not all file-like objects implement the name attribute.
1 parent 9ab6210 commit 6e5f593

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

sc2reader/utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -629,8 +629,8 @@ def read_header(replay_file):
629629

630630
#Sanity check that the input is in fact an MPQ file
631631
if buffer.empty or buffer.read_hex(4).upper() != "4D50511B":
632-
msg = "File '{0}' is not an MPQ file";
633-
raise exceptions.FileError(msg.format(replay_file.name))
632+
msg = "File '{}' is not an MPQ file";
633+
raise exceptions.FileError(msg.format(getattr(replay_file, 'name', '<NOT AVAILABLE>')))
634634

635635
max_data_size = buffer.read_int(LITTLE_ENDIAN)
636636
header_offset = buffer.read_int(LITTLE_ENDIAN)

0 commit comments

Comments
 (0)