-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix crash when parsing empty files #9
Conversation
@@ -124,6 +124,9 @@ def print_progress(self, threshold=0, decimals=1, barLength=100): | |||
# Based on @Greenstick's reply (https://stackoverflow.com/a/34325723) | |||
iteration = self.stream.tell() | |||
total = self.file_size | |||
if total == 0: | |||
return | |||
|
|||
progress = 100.0 * iteration / total | |||
if self.progress > 0 and progress - self.progress < threshold: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if self.progress > 0
Should be
if self.progress
@@ -124,6 +124,9 @@ def print_progress(self, threshold=0, decimals=1, barLength=100): | |||
# Based on @Greenstick's reply (https://stackoverflow.com/a/34325723) | |||
iteration = self.stream.tell() | |||
total = self.file_size | |||
if total == 0: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that this should be:
if not total:
But this is not enough intuitive. What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that reading "if not total" is not intuitive. It make sense to compare against 0.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree
The script crashes when the user tried to give as input an empty file.
I have also fix some links in the Messages.md file and add two command line commands to increase verbosity from the command line in Windows and with tcsh.