Skip to content

Commit 1ba3634

Browse files
committed
Account for file-like objects without filename support.
1 parent ef60adc commit 1ba3634

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

sc2reader/objects.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,12 @@ class Replay(object):
5050
def __init__(self, replay_file, **options):
5151
#Useful references
5252
self.opt = AttributeDict(**options)
53-
self.filename = replay_file.name
53+
54+
# Some file-like objects may not support filenames. Issue #21
55+
if hasattr(replay_file, 'name'):
56+
self.filename = replay_file.name
57+
else:
58+
self.filename = "Unavailable"
5459

5560
#header information
5661
self.versions,self.frames = read_header(replay_file)

0 commit comments

Comments
 (0)