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

ValueError when not giving multiple-match DiscID an integer #26

Closed
Freso opened this issue Nov 28, 2012 · 6 comments
Closed

ValueError when not giving multiple-match DiscID an integer #26

Freso opened this issue Nov 28, 2012 · 6 comments
Assignees
Milestone

Comments

@Freso
Copy link
Collaborator

Freso commented Nov 28, 2012

If you look up a DiscID which matches multiple releases and press enter (or presumably any non-numeric character), you will get this nice little exception:

Traceback (most recent call last):
  File "/usr/bin/isrcsubmit.py", line 620, in <module>
    releaseId = disc.release.getId()        # implicitly fetches release
  File "/usr/bin/isrcsubmit.py", line 348, in release
    self._release = self.getRelease(self._submit)
  File "/usr/bin/isrcsubmit.py", line 382, in getRelease
    self._release = results[int(num)].getRelease()
ValueError: invalid literal for int() with base 10: ''
@JonnyJD
Copy link
Owner

JonnyJD commented Nov 28, 2012

Yes, every entry that is no integer gives this exception and wrong numbers give a KeyError Exception.

I could catch these, print a simple "not a valid choice" and exit.

Or should I ask again until the user provides anything that works?

@Freso
Copy link
Collaborator Author

Freso commented Nov 28, 2012

Perhaps you could say "Could not interpret input. Do you want to try again? [Y/n]" - if "n", exit, if "Y" present the "menu" again?

I pressed enter to deliberately exit the script (as I wanted to look it up on the site before picking the release to continue with).

@JonnyJD
Copy link
Owner

JonnyJD commented Nov 28, 2012

Yes, I also use this exception to quit, rather than pressing CTRL+C..

Not really sure if another layer of "trying again" is worth it. You can just restart the script and you are in the same "menu" again in 1-2 seconds. It's not like you lose any previous (tidious) input.

@Freso
Copy link
Collaborator Author

Freso commented Nov 28, 2012

I'm fine with anything, I just like my programs to not show me a backtrace when I quit them. :)

@jesus2099
Copy link
Contributor

I would have liked it to quit in that circumstance, like isrcsubmit.exe did. cf. new issue #32.
What do you think, Freso.

@Freso
Copy link
Collaborator Author

Freso commented Dec 11, 2012

I'm fine with anything, I just like my programs to not show me a backtrace when I quit them. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants