Skip to content

Commit

Permalink
Simplify with .writable() method.
Browse files Browse the repository at this point in the history
Addresses #50 (comment)
  • Loading branch information
sobolevnrm committed Jun 4, 2020
1 parent 1d17cb0 commit 7085271
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions propka/output.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ def open_file_for_writing(input_file):
then will attempt to get file mode.
"""
try:
mode = input_file.mode
if not ("w" in mode or "a" in mode or "+" in mode):
if not input_file.writable():
raise IOError("File/stream not open for writing")
return input_file
except AttributeError:
Expand Down

0 comments on commit 7085271

Please sign in to comment.