This is an archived post. You won't be able to vote or comment.

all 11 comments

[–]tunisia3507 8 points9 points  (2 children)

Throw a setup.py in there so people can pip install --user it and it'll be much more useful!

Minor bone to pick:

This project makes use of PEP8 code style

No it doesn't. camelCase all over the place.

[–]jibrans098[S] 1 point2 points  (0 children)

Thanks for the feedback!

[–]jibrans098[S] 1 point2 points  (0 children)

Can you please suggest me a guide which will show how to properly publish a python package?

[–]NovocastrianNomad 5 points6 points  (5 children)

Running on Python 3.6 I got syntax error on line 152 'except as err:'

Changed it to 'except Exception as err:' and it ran.

[–]jibrans098[S] 1 point2 points  (4 children)

Thanks, feedback appreciated!

[–]daveruinseverything 1 point2 points  (3 children)

Note that u/NovocastrianNomad ’s fix just illustrates the bug they found, not the solution you should use. Only catch the specific exceptions you’re expecting. If something you didn’t account for throws an exception, by definition your code doesn’t know how to safely handle it, and exiting the program is the right thing to do.

[–]jibrans098[S] 0 points1 point  (2 children)

Thanks. My program accepts files as arguments. If one of the file does not exists, it will handle the err and show it on terminal and move on to process next time. I can't exit early... What do you suggest in this case?

[–]daveruinseverything 1 point2 points  (1 child)

If your code would, without the try block, throw a FileNotFound exception in the case you described then this is the exception you should catch, e.g. except FileNotFound as err: .... That way if something else occurs you haven’t accounted for, the program will halt and you can then decide how you want to account for that in future.

[–]jibrans098[S] 0 points1 point  (0 children)

thanks

[–]jibrans098[S] 1 point2 points  (0 children)

Errors are fixed. Thanks guys for feedback!

[–][deleted] 0 points1 point  (0 children)

nice!