#1379 closed defect (duplicate)

poor error message for wrong path syntax, e.g. "tahoe cp $CAP:$PATH ."

Reported by: zooko Owned by: davidsarah
Priority: major Milestone: eventually
Component: code-frontend-cli Version: 1.8.2
Keywords: usability cli error easy Cc:
Launchpad Bug:

Description

The error messages are unhelpful, but also it looks like there is a bug so that tahoe cp misparses the $CAP/path syntax in its source argument.

$ tahoe cp -v -r --node-url=http://localhost:3458 URI:DIR2-RO:o7mbbpxsznwfwiih5yzxmuqopq:cl72f3dnb6q7z4ajfjw24me5qwk7q7hfqrp5ho3dntuvoovspska:Latest .
error: you must specify a destination filename
$ tahoe cp -v -r --node-url=http://localhost:3458 URI:DIR2-RO:o7mbbpxsznwfwiih5yzxmuqopq:cl72f3dnb6q7z4ajfjw24me5qwk7q7hfqrp5ho3dntuvoovspska:Latest ./Latest
attaching sources to targets, 1 files / 0 dirs in root
targets assigned, 1 dirs, 2 files
starting copy, 2 files, 1 directories
Traceback (most recent call last):
  File "/Users/zooko/playground/tahoe-lafs/dw/support/bin/tahoe", line 9, in <module>
    load_entry_point('allmydata-tahoe==1.8.2-r5006', 'console_scripts', 'tahoe')()
  File "/Users/zooko/playground/tahoe-lafs/dw/src/allmydata/scripts/runner.py", line 113, in run
    rc = runner(sys.argv[1:], install_node_control=install_node_control)
  File "/Users/zooko/playground/tahoe-lafs/dw/src/allmydata/scripts/runner.py", line 99, in runner
    rc = cli.dispatch[command](so)
  File "/Users/zooko/playground/tahoe-lafs/dw/src/allmydata/scripts/cli.py", line 520, in cp
    rc = tahoe_cp.copy(options)
  File "/Users/zooko/playground/tahoe-lafs/dw/src/allmydata/scripts/tahoe_cp.py", line 762, in copy
    return Copier().do_copy(options)
  File "/Users/zooko/playground/tahoe-lafs/dw/src/allmydata/scripts/tahoe_cp.py", line 442, in do_copy
    status = self.try_copy()
  File "/Users/zooko/playground/tahoe-lafs/dw/src/allmydata/scripts/tahoe_cp.py", line 485, in try_copy
    return self.copy_to_directory(sources, target)
  File "/Users/zooko/playground/tahoe-lafs/dw/src/allmydata/scripts/tahoe_cp.py", line 664, in copy_to_directory
    self.copy_files_to_target(self.targetmap[target], target)
  File "/Users/zooko/playground/tahoe-lafs/dw/src/allmydata/scripts/tahoe_cp.py", line 695, in copy_files_to_target
    self.copy_file_into(source, name, target)
  File "/Users/zooko/playground/tahoe-lafs/dw/src/allmydata/scripts/tahoe_cp.py", line 739, in copy_file_into
    f = source.open(self.caps_only)
  File "/Users/zooko/playground/tahoe-lafs/dw/src/allmydata/scripts/tahoe_cp.py", line 178, in open
    url = self.nodeurl + "uri/" + urllib.quote(self.readcap)
  File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/urllib.py", line 1216, in quote
    res = map(safe_map.__getitem__, s)
TypeError: argument 2 to map() must support iteration
$ tahoe cp -v -r --node-url=http://localhost:3458 URI:DIR2-RO:o7mbbpxsznwfwiih5yzxmuqopq:cl72f3dnb6q7z4ajfjw24me5qwk7q7hfqrp5ho3dntuvoovspska:Latest/ .
examining 0 of 1
attaching sources to targets, 1 files / 0 dirs in root
targets assigned, 1 dirs, 2 files
starting copy, 2 files, 1 directories
Traceback (most recent call last):
  File "/Users/zooko/playground/tahoe-lafs/dw/support/bin/tahoe", line 9, in <module>
    load_entry_point('allmydata-tahoe==1.8.2-r5006', 'console_scripts', 'tahoe')()
  File "/Users/zooko/playground/tahoe-lafs/dw/src/allmydata/scripts/runner.py", line 113, in run
    rc = runner(sys.argv[1:], install_node_control=install_node_control)
  File "/Users/zooko/playground/tahoe-lafs/dw/src/allmydata/scripts/runner.py", line 99, in runner
    rc = cli.dispatch[command](so)
  File "/Users/zooko/playground/tahoe-lafs/dw/src/allmydata/scripts/cli.py", line 520, in cp
    rc = tahoe_cp.copy(options)
  File "/Users/zooko/playground/tahoe-lafs/dw/src/allmydata/scripts/tahoe_cp.py", line 762, in copy
    return Copier().do_copy(options)
  File "/Users/zooko/playground/tahoe-lafs/dw/src/allmydata/scripts/tahoe_cp.py", line 442, in do_copy
    status = self.try_copy()
  File "/Users/zooko/playground/tahoe-lafs/dw/src/allmydata/scripts/tahoe_cp.py", line 503, in try_copy
    return self.copy_to_directory(sources, target)
  File "/Users/zooko/playground/tahoe-lafs/dw/src/allmydata/scripts/tahoe_cp.py", line 664, in copy_to_directory
    self.copy_files_to_target(self.targetmap[target], target)
  File "/Users/zooko/playground/tahoe-lafs/dw/src/allmydata/scripts/tahoe_cp.py", line 695, in copy_files_to_target
    self.copy_file_into(source, name, target)
  File "/Users/zooko/playground/tahoe-lafs/dw/src/allmydata/scripts/tahoe_cp.py", line 739, in copy_file_into
    f = source.open(self.caps_only)
  File "/Users/zooko/playground/tahoe-lafs/dw/src/allmydata/scripts/tahoe_cp.py", line 178, in open
    url = self.nodeurl + "uri/" + urllib.quote(self.readcap)
  File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/urllib.py", line 1216, in quote
    res = map(safe_map.__getitem__, s)
TypeError: argument 2 to map() must support iteration
$ tahoe cp -v -r --node-url=http://localhost:3458 URI:DIR2-RO:o7mbbpxsznwfwiih5yzxmuqopq:cl72f3dnb6q7z4ajfjw24me5qwk7q7hfqrp5ho3dntuvoovspska:Latest/ ./Latest
attaching sources to targets, 1 files / 0 dirs in root
targets assigned, 1 dirs, 2 files
starting copy, 2 files, 1 directories
Traceback (most recent call last):
  File "/Users/zooko/playground/tahoe-lafs/dw/support/bin/tahoe", line 9, in <module>
    load_entry_point('allmydata-tahoe==1.8.2-r5006', 'console_scripts', 'tahoe')()
  File "/Users/zooko/playground/tahoe-lafs/dw/src/allmydata/scripts/runner.py", line 113, in run
    rc = runner(sys.argv[1:], install_node_control=install_node_control)
  File "/Users/zooko/playground/tahoe-lafs/dw/src/allmydata/scripts/runner.py", line 99, in runner
    rc = cli.dispatch[command](so)
  File "/Users/zooko/playground/tahoe-lafs/dw/src/allmydata/scripts/cli.py", line 520, in cp
    rc = tahoe_cp.copy(options)
  File "/Users/zooko/playground/tahoe-lafs/dw/src/allmydata/scripts/tahoe_cp.py", line 762, in copy
    return Copier().do_copy(options)
  File "/Users/zooko/playground/tahoe-lafs/dw/src/allmydata/scripts/tahoe_cp.py", line 442, in do_copy
    status = self.try_copy()
  File "/Users/zooko/playground/tahoe-lafs/dw/src/allmydata/scripts/tahoe_cp.py", line 503, in try_copy
    return self.copy_to_directory(sources, target)
  File "/Users/zooko/playground/tahoe-lafs/dw/src/allmydata/scripts/tahoe_cp.py", line 664, in copy_to_directory
    self.copy_files_to_target(self.targetmap[target], target)
  File "/Users/zooko/playground/tahoe-lafs/dw/src/allmydata/scripts/tahoe_cp.py", line 695, in copy_files_to_target
    self.copy_file_into(source, name, target)
  File "/Users/zooko/playground/tahoe-lafs/dw/src/allmydata/scripts/tahoe_cp.py", line 739, in copy_file_into
    f = source.open(self.caps_only)
  File "/Users/zooko/playground/tahoe-lafs/dw/src/allmydata/scripts/tahoe_cp.py", line 178, in open
    url = self.nodeurl + "uri/" + urllib.quote(self.readcap)
  File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/urllib.py", line 1216, in quote
    res = map(safe_map.__getitem__, s)
TypeError: argument 2 to map() must support iteration

Change History (4)

comment:1 Changed at 2011-05-15T00:21:08Z by davidsarah

If Latest is a subdirectory of the given dircap, shouldn't it be:

tahoe cp -v -r --node-url=http://localhost:3458 URI:DIR2-RO:blah/Latest ./Latest

?

(I.e. you have "tahoe cp $CAP:$PATH .", not "tahoe cp $CAP/$PATH ." in the examples.)

Having said that, "TypeError: argument 2 to map() must support iteration" is a horrible way to report the error.

comment:2 Changed at 2011-07-27T16:18:14Z by davidsarah

  • Keywords easy added
  • Milestone changed from undecided to 1.10.0
  • Owner set to davidsarah
  • Status changed from new to assigned

comment:3 Changed at 2011-08-03T21:57:21Z by davidsarah

  • Resolution set to duplicate
  • Status changed from assigned to closed
  • Summary changed from misparse of "tahoe cp $CAP/$PATH ." to poor error message for wrong path syntax, e.g. "tahoe cp $CAP:$PATH ."

I'm merging this with #1217, since the incorrect path syntax is the same ($CAP:$PATH). I don't know why the error message is different; perhaps it's because this ticket has an incorrect source argument whereas #1217 has an incorrect destination argument.

comment:4 Changed at 2012-04-01T00:00:48Z by davidsarah

  • Milestone changed from 1.11.0 to eventually
Note: See TracTickets for help on using tickets.