I have been reading the documentation of the pyinstaller for hours. I cannot understand how to use the option --resource RESOURCE
It says
-r RESOURCE, --resource RESOURCEAdd or update a resource to a Windows executable. The
RESOURCEis one to four items,**FILE[,TYPE[,NAME[,LANGUAGE]]]**.FILEcan be a data file or an exe/dll. For data files, at leastTYPEandNAMEmust be specified.LANGUAGEdefaults to 0 or may be specified as wildcard * to update all resources …
我通过pydrive使用Google Drive API 在两个谷歌驱动器帐户之间移动文件.我一直在测试一个包含16个文件的文件夹.我的代码总是在第六个文件中引发错误
"超出用户速率限制">
我知道请求数量有限制(10/s或1000/100s),但我已尝试使用Google Drive API建议的指数退避来处理此错误.即使在248秒之后,它仍然会引发同样的错误.
这是我正在做的一个例子
def MoveToFolder(self,files,folder_id,drive):
total_files = len(files)
for cont in range(total_files):
success = False
n=0
while not success:
try:
drive.auth.service.files().copy(fileId=files[cont]['id'],
body={"parents": [{"kind": "drive#fileLink", "id": folder_id}]}).execute()
time.sleep(random.randint(0,1000)/1000)
success = True
except:
wait = (2**n) + (random.randint(0,1000)/1000)
time.sleep(wait)
success = False
n += 1
Run Code Online (Sandbox Code Playgroud)
我尝试使用"批处理请求"来复制文件,但它会为10个文件引发相同的错误.
def MoveToFolderBatch(self,files,folder_id,drive):
cont=0
batch = drive.auth.service.new_batch_http_request()
for file in files:
cont+=1
batch.add(drive.auth.service.files().copy(fileId=file['id'],
body={"parents": [
{"kind": "drive#fileLink", "id": folder_id}]}))
batch.execute()
Run Code Online (Sandbox Code Playgroud)
有人有任何提示吗?
编辑:根据谷歌支持:
关于超出用户速率限制错误,与控制台中设置的每用户速率限制完全无关.相反,它来自Drive API依赖的内部Google系统,并且最有可能在单个帐户拥有域中的所有文件时发生.我们不建议单个帐户拥有所有文件,而是让域中的个人用户拥有这些文件.要传输文件,您可以查看此链接.另外,请检查建议上的此链接以避免错误.
python google-api google-drive-api google-api-python-client pydrive