Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IOError: [Errno 13] file not accessible GAE

I want to access a file in my computer from a google app engine application. If I put the file in the src folder of the application there is no problem but I need this file to be out of that folder.

When I try to access this file I get the next error:

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'

I have read that if a file is defined as static in app.yaml can't be accessible from GAE. This is my app.yaml. I can't figure out if there is something wrong:

application: myapp
version: 1
runtime: python
api_version: 1

handlers:
- url: /.*
script: myapp.py

And this is the part of the application that tries to access the file:

filename='C:/Users/path_to_file/Documento 1.docx'
media_body = MediaFileUpload(filename,resumable=True)

Does someone know why do I get the "file not accessible" error?

Thanks!

like image 458
user1930068 Avatar asked Jan 02 '13 12:01

user1930068


1 Answers

Put the file in the same directory as the rest of your applications files (i.e. where the app.yaml is).

All the files you want your application to access have to be in the same place, under your main application directory.

GAE can't access arbitrary files somewhere on your computer, just like it cannot access files saved "somewhere" else when deployed.

filename='myfile.doc'

That's assuming it's in the 'root' (same as app.yaml).

like image 125
Paul Collingwood Avatar answered Oct 20 '22 15:10

Paul Collingwood