2012-01-10 14 views
10

Quizás sea un error, pero de todos modos publicaré aquí.IOError: archivo [Errno 13] no accesible con Google AppEngine 1.6.1

me sale el siguiente tema en mi servidor de prueba AppEngine locales:

WARNING 2012-01-10 06:08:40,336 rdbms_mysqldb.py:90] The rdbms API is not available because the MySQLdb library could not be loaded. 
INFO  2012-01-10 06:08:40,470 appengine_rpc.py:159] Server: appengine.google.com 
INFO  2012-01-10 06:08:40,474 appcfg.py:561] Checking for updates to the SDK. 
INFO  2012-01-10 06:08:40,990 appcfg.py:574] Update check failed: HTTP Error 404: Not Found 
WARNING 2012-01-10 06:08:47,643 dev_appserver.py:3344] Could not initialize images API; you are likely missing the Python "PIL" module. ImportError: No module named _imaging 
INFO  2012-01-10 06:08:47,654 dev_appserver_multiprocess.py:638] Running application dev~project_name on port 8080: http://localhost:8080 
INFO  2012-01-10 06:08:47,654 dev_appserver_multiprocess.py:640] Admin console is available at: http://localhost:8080/_ah/admin 
INFO  2012-01-10 06:09:14,989 dev_appserver_index.py:338] Created 2 and deleted 0 index(es); total 2 
WARNING 2012-01-10 06:09:15,480 py_zipimport.py:139] Can't open zipfile /Users/ca/.pythonbrew/venvs/Python-2.7.2/project_name/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg: IOError: [Errno 13] file not accessible: '/Users/ca/.pythonbrew/venvs/Python-2.7.2/project_name/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg' 
ERROR 2012-01-10 06:09:16,927 bottle.py:746] Traceback (most recent call last): 
    File "/Users/ca/Dropbox/Perso/projects/project_name/Source/project_name/lib/bottle.py", line 735, in _handle 
    return route.call(**args) 
    File "/Users/ca/Dropbox/Perso/projects/project_name/Source/project_name/lib/bottle.py", line 1451, in wrapper 
    rv = callback(*a, **ka) 
    File "/Users/ca/Dropbox/Perso/projects/project_name/Source/project_name/tools.py", line 41, in render_to_response 
    template = jinja_env.get_template(template_name) 
    File "/Users/ca/.pythonbrew/venvs/Python-2.7.2/project_name/lib/python2.7/site-packages/jinja2/environment.py", line 719, in get_template 
    File "/Users/ca/.pythonbrew/venvs/Python-2.7.2/project_name/lib/python2.7/site-packages/jinja2/environment.py", line 693, in _load_template 
    File "/Users/ca/.pythonbrew/venvs/Python-2.7.2/project_name/lib/python2.7/site-packages/jinja2/loaders.py", line 115, in load 
    File "/Users/ca/.pythonbrew/venvs/Python-2.7.2/project_name/lib/python2.7/site-packages/jinja2/loaders.py", line 165, in get_source 
    File "/Users/ca/.pythonbrew/venvs/Python-2.7.2/project_name/lib/python2.7/site-packages/jinja2/utils.py", line 224, in open_if_exists 
    File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/dev_appserver_import_hook.py", line 578, in __init__ 
    raise IOError(errno.EACCES, 'file not accessible', filename) 
IOError: [Errno 13] file not accessible: '/Users/ca/Dropbox/Perso/Projects/project_name/Source/project_name/templates/tools_list.html' 

INFO  2012-01-10 06:09:16,962 dev_appserver.py:2832] "GET/HTTP/1.1" 500 - 
INFO  2012-01-10 06:09:16,974 dev_appserver_index.py:255] Updating /Users/ca/Dropbox/Perso/projects/project_name/Source/project_name/index.yaml 
WARNING 2012-01-10 06:11:36,153 py_zipimport.py:139] Can't open zipfile /Users/ca/.pythonbrew/venvs/Python-2.7.2/project_name/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg: IOError: [Errno 13] file not accessible: '/Users/ca/.pythonbrew/venvs/Python-2.7.2/project_name/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg' 

puedo estar equivocado, pero parece que se trata de un problema que no estaba recibiendo antes. Dado que Google App Engine se lanzó el 13 de diciembre de 2011; Me pregunto si podría venir de esta versión.

estoy usando pythonbrew, virtualenv, Mac OS X 10.6.8

Gracias por su ayuda!

Respuesta

4

En lugar de hacer referencia a mi variable usando una variable de ruta codificado, ahora estoy usando:

PROJECT_DIR = os.path.dirname(__file__) 

y está funcionando. Te avisaré si el problema vuelve (vi algunos artículos describiéndolo como recurrentes al azar).

También aplica el parche en el comentario 29 de http://code.google.com/p/googleappengine/issues/detail?id=4339

+0

Dónde puedo añadir esta project_dir? –

+0

Tengo un 'settings.py' que importo en todos los archivos donde necesito acceder a esas variables globales. – charlax

6

Simplemente quite el archivo setuptools-0.6c11-py2.7.egg de sus paquetes de sitio.

Encuentra la ubicación de su sitio empaqueta

inicio pitón de la CLI:

python 

paquetes sitio de lista:

>>> import site; site.getsitepackages() 
13

tengo otra respuesta a su problema, que he experimentado por mi mismo. Si usted tiene por ejemplo un directorio de plantillas de la siguiente manera:

templates 
|-- css 
|-- img 
|-- js 
|-- html 

Y su archivo app.yaml así:

- url: /templates 
    static_dir: templates 

no son capaces de hacer una plantilla con Jinja2 si se utiliza este nombre:

JINJA_ENVIRONMENT.get_template('html/index.html') 

creo que es porque la opción de alguna manera static_dir bloques de este directorio para Jinja2, al menos creo que sí, puede que ayude a alguien!

+5

Sí, tuve este problema. GAE actualmente no permite el acceso a archivos en 'static_dir' desde dentro del código de la aplicación. – MrD

+1

Ese es solo el comportamiento predeterminado. Pero se puede anular usando la opción 'application_readable: true', vea http://stackoverflow.com/a/16541092/4495081 –

0

Me he sentido confundido por un problema similar - IOError al importar un archivo/paquete de huevos de los paquetes de sitio. Estoy usando Ubuntu 13.10, GAE 1.8.8, virtualenv y python 2.7.

Al final, me di cuenta de que no podía importar nada de lo que instalé usando easy_install (que de forma predeterminada coloca archivos egg en site_packages).

Una vez que desinstalé todos estos huevos, y reinstalé usando pip install comando, todo comenzó a funcionar normalmente.

Esperando que esto le ahorre a alguien más algo de tiempo, ya que nunca recuperaré mis horas perdidas.

0

En algunos casos, este error se debe a que dev_appserver.py no devuelve la llamada abierta cuando el nombre del archivo coincide con el patrón skip_files en app.yaml. Compruebe app.yaml incluso cuando ejecute dev_appserver.py localmente.

2

puede ser tarde, pero tal vez podría ayudar a otra persona.
así, cuando se agrega

jinja2.FileSystemLoader(os.path.join(os.path.dirname(__file__), 'templates')) 

no aportan
- url: /templates static_dir: templates
a su app.yaml archivo

+0

O también agregue' application_readable: true'. http://stackoverflow.com/a/16541092/4495081 –

Cuestiones relacionadas