Skip to content
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

Merged
merged 4 commits into from
Dec 14, 2016
Merged

Fix crash when parsing empty files #9

merged 4 commits into from
Dec 14, 2016

Conversation

pleonex
Copy link
Contributor

@pleonex pleonex commented Dec 11, 2016

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.

@pleonex pleonex added the bug label Dec 11, 2016
@pleonex pleonex added this to the v1.2 milestone Dec 11, 2016
@pleonex pleonex self-assigned this Dec 11, 2016
@pleonex pleonex requested a review from iblancasa December 14, 2016 10:23
@@ -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:
Copy link
Contributor

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:
Copy link
Contributor

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?

Copy link
Contributor Author

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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree

@iblancasa iblancasa merged commit a054887 into master Dec 14, 2016
@pleonex pleonex deleted the fix_emptyfiles branch December 14, 2016 17:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants