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

Comments

Projects
None yet
3 participants
@Freso
Contributor

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

This comment has been minimized.

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

This comment has been minimized.

Contributor

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

This comment has been minimized.

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

This comment has been minimized.

Contributor

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

This comment has been minimized.

Contributor

jesus2099 commented Dec 11, 2012

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

@Freso

This comment has been minimized.

Contributor

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