2012-01-10 15 views
10

Forse è un bug, ma sto postando qui comunque.IOError: [Errno 13] file non accessibile con Google AppEngine 1.6.1

ottengo il seguente problema sul mio server di prova AppEngine locale:

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' 

Posso sbagliarmi, ma sembra che si tratta di un problema che non è stato sempre prima. Poiché Google App Engine è stato rilasciato il 13 dicembre 2011; Mi chiedo se potrebbe venire da questa versione.

sto usando pythonbrew, virtualenv, Mac Os X 10.6.8

Grazie per il vostro aiuto!

risposta

4

Invece referenziare la mia variabile utilizzando una variabile percorso hardcoded, ora sto usando:

PROJECT_DIR = os.path.dirname(__file__) 

e che sta funzionando. Ti farò sapere se il problema ritorna (ho visto alcuni articoli che lo descrivevano come casualmente ricorrenti).

ho anche applicato la patch in commento 29 su http://code.google.com/p/googleappengine/issues/detail?id=4339

+0

Dove posso aggiungere questo project_dir? –

+0

Ho un 'settings.py' che importa in tutti i file in cui ho bisogno di accedere a quelle variabili globali. – charlax

6

Basta rimuovere il file setuptools-0.6c11-py2.7.egg dai vostri pacchetti del sito.

Trovare la posizione dei pacchetti del sito

Inizio pitone CLI:

python 

pacchetti sito di listino:

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

ho un'altra risposta al suo problema, che ho sperimentato da solo. Se si dispone ad esempio di una directory modelli come questo:

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

e il file app.yaml in questo modo:

- url: /templates 
    static_dir: templates 

Non sono in grado di rendere un modello con Jinja2 se si utilizza questo nome:

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

penso che sia perché l'opzione static_dir in qualche modo blocca questa directory per Jinja2, almeno io la penso così, forse aiuta qualcuno!

+5

Sì, ho avuto questo problema. Al momento GAE non consente l'accesso ai file in 'static_dir' dal codice dell'applicazione. – MrD

+1

Questo è solo il comportamento predefinito. Ma può essere sostituito usando l'opzione 'application_readable: true', vedi http://stackoverflow.com/a/16541092/4495081 –

0

Sono stato sconcertato da un problema simile - IOError durante l'importazione di un file/pacchetto di uova dai pacchetti del sito. Sto usando Ubuntu 13.10, GAE 1.8.8, virtualenv e python 2.7.

Alla fine, ho capito che non potevo importare nulla che ho installato usando easy_install (che per impostazione predefinita mette i file egg in site_packages).

Dopo aver disinstallato tutte queste uova e reinstallato utilizzando il comando installando, tutto ha iniziato a funzionare normalmente.

Sperando che questo salverà qualcun altro un po 'di tempo, poiché non riuscirò mai a recuperare le mie ore sprecate.

0

In alcuni casi, questo errore è causato da dev_appserver.py che restituisce un errore per la chiamata aperta quando il nome del file corrisponde a un modello skip_files in app.yaml. Controlla app.yaml anche quando esegui dev_appserver.py localmente.

2

potrebbe essere in ritardo, ma forse potrebbe aiutare qualcun altro.
così, quando si aggiunge

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

non aggiungono
- url: /templates static_dir: templates
al app.yaml file di

+0

o aggiungi anche' application_readable: true'. http://stackoverflow.com/a/16541092/4495081 –

Problemi correlati