dropbox v2 python api 的 createfolder arg() 函数的格式有什么问题?

What is wrong with the format of createfolderarg() funtion of the dropbox v2 python api?

def CreateDropboxFolder(路径,文件夹名称):

##Connect to Dropbox with Supplied Access token
    print('Connecting to Dropbox...')
    dbx = dropbox.Dropbox('')
    print('Connected to Dropbox')

##Reset Variables
    DirExists=False

    ##Set Directory
    TempDir=Path+FolderName
    print('Started Creating New Directory: ' + TempDir + ' ...')

    ##Check if Location exists
    print ('Searching for Existing Directory in '+ Path)
    for entry in dbx.files_list_folder(path=os.path.dirname(Path)).entries:
            print (entry.name)
            if(entry.name==FolderName):
                    DirExists=True
                    break

    ##If Folder Directory exists Skip Create Directory
    if DirExists==True:
            print ('Folder Already Exists')

    ##If Folder Directory exists Create Directory
    else:
            ##Create Client Directory
            print('Creating New Directory: ' + TempDir)
            dropbox.files.CreateFolderArg(os.path.dirname(TempDir))
            print('Created New Directory: ' + TempDir)

    return TempDir

每个部分都有效。除了上述功能。我已经尝试了很多方法来格式化目录字符串,但它就是行不通。经过 2 晚的挫折,我正要拔掉我的头发。 我一直在传递 Path='/Projects/',这是我的 Dropbox 文件夹根目录中的一个现有目录,FolderName = 'test'.

顾名思义,

CreateFolderArg 是一个 class,它对应于您要传递给创建文件夹的参数。您正在创建 class 的实例,但没有对其进行任何操作。

我认为您可能正在寻找 dbx.files_create_folder(TempDir)