Python azcopy:由于错误,无法分析用户输入:当前不支持推断的源/目标组合

Python azcopy:由于错误,无法分析用户输入:当前不支持推断的源/目标组合,python,azure,blob,azcopy,Python,Azure,Blob,Azcopy,我目前正在开发一个程序,当我运行它时,它将使用SAS将blob数据从我的VM传输到我的azure存储。到目前为止,我编写的代码如下: import subprocess import os import sys try: key = input("Please insert SAS: ") #file_path = input("Please insert the full file path where the data is located: ") full_link

我目前正在开发一个程序,当我运行它时,它将使用SAS将blob数据从我的VM传输到我的azure存储。到目前为止,我编写的代码如下:

import subprocess
import os
import sys
try:
    key = input("Please insert SAS: ")
    #file_path = input("Please insert the full file path where the data is located: ")
    full_link = ("\"https://myblob.blob.core.windows.net/" + key + "\"")
    #print('\n File path: '+ full_link +'\n')
#Subprocess that performs data transfer to storage from the desired path
    subprocess.call(['azcopy', 'cp', '/directory/subdirectory', 
                    full_link,
                    '--recursive=true'], stderr=subprocess.STDOUT)
    print('Transfer Complete.')

#Exception for exit error
except subprocess.CalledProcessError as e:
     raise RuntimeError("command '{}' return with error (code {}): {}".format(e.cmd, e.returncode, e.output))

#Exception for EOF error, would be caused by missing token
except EOFError as error:
    print('Error with token')

#When an unexpected error has occured.
except Exception as e:
    print(str(e) + 'Unknown error has occured')
exit(0)
运行此操作时,我收到以下错误:

failed to parse user input due to error: the inferred source/destination combination is currently not supported.
我不确定问题是什么,因为当我在终端中运行实际命令时,它会执行我想要的数据复制。命令如下:

sudo ./azcopy cp "/directory/subdirectory" "https://myblob.blob.core.windows.net/darknet-index[SAS]" --recursive=true

非常感谢您的帮助。

可能它无法将/directory/子目录解析为真实的磁盘位置,因为从Python应用程序中运行它时,工作目录不同。

完整链接中缺少blob容器名称

这是我在windows上运行的代码,您可以将其更改为在linux上运行:

import subprocess
import os
import sys
try:
    #sas token
    key = '?sv=2019-02-02&xx'

    #define the container name in blob storage
    mycontainer = "test6"
    exepath = "F:\\azcopy\\latest\\azcopy.exe"
    local_directory="F:\\temp\\1\\test2\\*"
    endpoint="https://xxx.blob.core.windows.net/"+mycontainer

    myscript=exepath + " cp " + "\""+ local_directory + "\" " + "\""+endpoint + key + "\"" + " --recursive"

    print(myscript)
    subprocess.call(myscript)

    print('Transfer Complete.')

#Exception for exit error
except subprocess.CalledProcessError as e:
     raise RuntimeError("command '{}' return with error (code {}): {}".format(e.cmd, e.returncode, e.output))

#Exception for EOF error, would be caused by missing token
except EOFError as error:
    print('Error with token')

#When an unexpected error has occured.
except Exception as e:
    print(str(e) + 'Unknown error has occured')
exit(0)
测试结果:


如果我在python命令工作的同一位置运行我提供的命令,那么这不应该是问题所在。您有哪个版本的AzCopy?您可以通过运行
AzCopy version查看该版本
我使用的是10.3.2版,很抱歉,我不知道可能是什么问题。很遗憾,这并没有解决问题,我已向Microsoft支持部门提交了一份票证,您的推荐帮助我清理了代码。非常感谢。@Buzzkillionair,好的,如果ms支持部门有任何反馈,请与我们分享根本原因:)。等我得到回复后就可以了。不幸的是,Microsoft无法提供帮助,azcopy git也无法提供帮助。对不起,我找不到这个问题的答案