在Python中从Dropbox下载文件时出现权限被拒绝错误
通过一个文件夹的元数据,我可以获得要下载到本地计算机的文件的相对文件路径。当我给出dou_get的源代码的这个路径时,它给了我权限被拒绝的错误。这是应该下载并解密文件的代码,但它不能直接下载文件在Python中从Dropbox下载文件时出现权限被拒绝错误,python,dropbox,dropbox-api,Python,Dropbox,Dropbox Api,通过一个文件夹的元数据,我可以获得要下载到本地计算机的文件的相对文件路径。当我给出dou_get的源代码的这个路径时,它给了我权限被拒绝的错误。这是应该下载并解密文件的代码,但它不能直接下载文件 @command def do_decryptFiles(self, from_path, to_path, key): """ Decrypt all the files given in the folder and subfolders of from_path
@command
def do_decryptFiles(self, from_path, to_path, key):
"""
Decrypt all the files given in the folder and subfolders of from_path
Examples:
Dropbox> decryptFiles '/Photos' 'E:\temp' 'a13223132323232'
"""
folder_metadata = self.api_client.metadata(from_path)
print "metadata:", folder_metadata
for s in folder_metadata['contents']:
if(s['is_dir'] == True):
print "directory:", s['path']
else:
FFPath = s['path']
print FFPath
do_get(self, from_path, to_path)
to_file = open(os.path.abspath(to_path), "wb")
f, metadata = self.api_client.get_file_and_metadata(self.current_path + FFPath)
to_file.write(f.read())
当它调用open时,命令行给我权限被拒绝的错误。任何帮助都将不胜感激
Traceback (most recent call last):
File "example/cli_client.py", line 397, in <module>
main()
File "example/cli_client.py", line 394, in main
term.cmdloop()
File "C:\Python27\lib\cmd.py", line 142, in cmdloop
stop = self.onecmd(line)
File "C:\Python27\lib\cmd.py", line 219, in onecmd
return func(arg)
File "example/cli_client.py", line 77, in wrapper
return f(self, *args)
File "example/cli_client.py", line 315, in do_decryptFiles
to_file = open(os.path.abspath(to_path), "wb")
IOError: [Errno 13] Permission denied: 'E:\\proto'
听起来是本地目录权限问题?我最近也遇到过类似的问题,如果是的话,有一些可能的解决办法 在我看来,这不是Dropbox API问题,而是本地IO错误