我想從Google應用程序引擎應用程序訪問我的計算機中的文件。如果我將該文件放在應用程序的src文件夾中,則沒有問題,但我需要此文件超出該文件夾。IOError:[Errno 13]文件無法訪問GAE
當我嘗試訪問該文件,我得到了一個錯誤:
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'
我已閱讀,如果一個文件被app.yaml中定義爲靜態無法從GAE訪問。這是我的app.yaml。我想不通,如果有什麼錯誤:
application: myapp
version: 1
runtime: python
api_version: 1
handlers:
- url: /.*
script: myapp.py
這是一種嘗試訪問該文件的應用程序的一部分:
filename='C:/Users/path_to_file/Documento 1.docx'
media_body = MediaFileUpload(filename,resumable=True)
是否有人知道爲什麼我會得到「文件不可訪問「錯誤?
謝謝!
的可能重複[ IOError:\ [Errno 13 \]文件無法通過Google AppEngine 1.6.1訪問](http://stackoverflow.com/questions/8799304/ioerror-errno-13-file-not-accessible-with-google-appengine-1 -6-1) – bain