thomasvs / morituri

For those about to RIP - a Unix CD ripper preferring accuracy over speed
GNU General Public License v3.0
301 stars 42 forks source link

Crash if no path specified for '-O' option #18

Open Hawke opened 11 years ago

Hawke commented 11 years ago

According to the help output: -O OUTPUT_DIRECTORY, --output-directory=OUTPUT_DIRECTORY output directory; will be included in file paths in result files (defaults to absolute path to current directory; set to empty if you want paths to be relative instead)

However, 'rip cd rip -O' will crash: File "…morituri/morituri/extern/command/command.py", line 114, in parse_args return optparse.OptionParser.parse_args(self, args, values) File "/usr/lib/python2.7/optparse.py", line 1399, in parse_args stop = self._process_args(largs, rargs, values) File "/usr/lib/python2.7/optparse.py", line 1443, in _process_args self._process_short_opts(rargs, values) File "/usr/lib/python2.7/optparse.py", line 1550, in _process_short_opts option.process(opt, value, values, self) UnboundLocalError: local variable 'value' referenced before assignment

You need to explicitly specify the value as "" or something before it will work. It would be better if this were not necessary.

thomasvs commented 11 years ago

The bug really is in optparse. I'll see if I can work around it. The argument is not optional, so if explicitly you want relative paths, you need to set it to an empty value using ""

Hawke commented 11 years ago

Still crashes for me in current git…

thomasvs commented 11 years ago

Works here: $ rip cd rip -O Usage: rip cd rip

rip: error: -O option requires an argument

what is your actual command line and what is the traceback?

Hawke commented 11 years ago

$ rip cd rip -O Usage: rip cd rip

rip: error: -O option requires an argument Traceback (most recent call last): File "/home/$USER/Documents/Source/git/morituri/bin/rip", line 39, in sys.exit(main.main(sys.argv[1:])) File "/home/$USER/Documents/Source/git/morituri/morituri/rip/main.py", line 45, in main ret = c.parse(argv) File "/home/$USER/Documents/Source/git/morituri/morituri/rip/main.py", line 123, in parse logcommand.LogCommand.parse(self, argv) File "/home/$USER/Documents/Source/git/morituri/morituri/extern/command/command.py", line 385, in parse return self.subCommands[command].parse(args[1:]) File "/home/$USER/Documents/Source/git/morituri/morituri/extern/command/command.py", line 385, in parse return self.subCommands[command].parse(args[1:]) File "/home/$USER/Documents/Source/git/morituri/morituri/extern/command/command.py", line 299, in parse self.options, args = self.parser.parse_args(argv) File "/home/$USER/Documents/Source/git/morituri/morituri/extern/command/command.py", line 114, in parse_args return optparse.OptionParser.parse_args(self, args, values) File "/usr/lib/python2.7/optparse.py", line 1399, in parse_args stop = self._process_args(largs, rargs, values) File "/usr/lib/python2.7/optparse.py", line 1443, in _process_args self._process_short_opts(rargs, values) File "/usr/lib/python2.7/optparse.py", line 1550, in _process_short_opts option.process(opt, value, values, self) UnboundLocalError: local variable 'value' referenced before assignment

thomasvs commented 11 years ago

I don't see how this can be happening. Can you rerun the same command, with RIP_DEBUG=5 this time? Please make sure you run latest git master.

Freso commented 10 years ago

I can't reproduce the issue. Are you still getting this @Hawke?