Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/293.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/eclipse/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
从Python调用外部命令时出现问题_Python_Eclipse_Amazon Web Services_Pydev - Fatal编程技术网

从Python调用外部命令时出现问题

从Python调用外部命令时出现问题,python,eclipse,amazon-web-services,pydev,Python,Eclipse,Amazon Web Services,Pydev,我正在尝试使用Eclipse中的Python(Pydev)将压缩文件的一些目录从AWS bucket复制到Windows机器 当我使用以下命令时: result = subprocess.Popen([r'aws s3 cp s3://myBucket/' + str(someInt) + '/ ' + output_dir + ' --recursive'], stdout=subprocess.PIPE) 我得到一个错误: FileNotFoundError: [WinError 2] T

我正在尝试使用Eclipse中的Python(Pydev)将压缩文件的一些目录从AWS bucket复制到Windows机器

当我使用以下命令时:

result = subprocess.Popen([r'aws s3 cp s3://myBucket/' + str(someInt) + '/ ' + output_dir + ' --recursive'], stdout=subprocess.PIPE)
我得到一个错误:

FileNotFoundError: [WinError 2] The system cannot find the file specified
但是,如果我将经过计算的参数粘贴到Windows命令行中,它将成功复制文件。我还能够使用R成功执行AWS命令:

result <- shell(paste0("aws ", "s3 ", "cp ", "s3://myBucket/", someInt, "/ ", output_dir, " --recursive"))

是的,我看到了。我以前使用过subprocess.Popen,它对我很有用。在这个特定的例子中,它给我带来了麻烦。我相信Popen希望有一个像['aws','s3','cp',…]这样的列表,看起来这是主要问题。非常感谢。
result = subprocess.Popen(['aws', 's3', 'cp', r's3://myBucket' + str(someInt) + '/', output_dir, '--recursive'], stdout=subprocess.PIPE)