Skip to content

Commit dae680c

Browse files
committed
Fixes #1363 - Fixes 'dict_keys' not subscriptable for remote2local with
one local copy _set_local_filename can be called with copy_paris as remote_list, and "copy_pairs" is a normal dict and not a FileDict. So, in that case, copy_pairs.keys() will be a view in py3 and so not subscriptable.
1 parent 8ca6afe commit dae680c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

s3cmd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1411,10 +1411,10 @@ def cmd_sync_remote2local(args):
14111411
if not os.path.isdir(deunicodise(destination_base)):
14121412
raise ParameterError("Destination is not an existing directory")
14131413
elif len(remote_list) == 1 and \
1414-
source_args[0] == remote_list[remote_list.keys()[0]].get(u'object_uri_str', ''):
1414+
source_args[0] == remote_list[next(iter(remote_list.keys()))].get(u'object_uri_str', ''):
14151415
if os.path.isdir(deunicodise(destination_base)):
14161416
raise ParameterError("Destination already exists and is a directory")
1417-
remote_list[remote_list.keys()[0]]['local_filename'] = destination_base
1417+
remote_list[next(iter(remote_list.keys()))]['local_filename'] = destination_base
14181418
return
14191419

14201420
if destination_base[-1] != os.path.sep:

0 commit comments

Comments
 (0)