我想从谷歌应用引擎应用程序访问我的计算机中的文件.如果我把文件放在应用程序的src文件夹中没有问题,但我需要这个文件超出该文件夹.
当我尝试访问此文件时,我收到下一个错误:
Traceback (most recent call last):
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\ext\webapp\_webapp25.py", line 712, in __call__
handler.post(*groups)
File "C:\Users\path\Documents\path\oauth2client\appengine.py", line 469, in check_oauth
return method(request_handler, *args, **kwargs)
File "C:\Users\path\Documents\path\myapp.py", line 88, in post
filename=open('C:/Users/path_to_file/Documento 1.docx','r')
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", line 635, in __init__
raise IOError(errno.EACCES, 'file not accessible', filename)
IOError: [Errno 13] file not accessible: 'C:/Users/path_to_file/Documento 1.docx'
Run Code Online (Sandbox Code Playgroud)
我已经读过,如果在app.yaml中将文件定义为静态,则无法从GAE访问.这是我的app.yaml.我无法弄清楚是否有错误:
application: myapp
version: 1
runtime: python
api_version: 1
handlers:
- url: /.*
script: myapp.py
Run Code Online (Sandbox Code Playgroud)
这是尝试访问该文件的应用程序的一部分:
filename='C:/Users/path_to_file/Documento 1.docx'
media_body = MediaFileUpload(filename,resumable=True)
Run Code Online (Sandbox Code Playgroud)
有人知道我为什么会收到"文件无法访问"错误?
谢谢!