IOError: [Errno 13] file not accessible with Google AppEngine 1.6.1

前端 未结 6 1899
攒了一身酷
攒了一身酷 2020-12-16 17:58

Maybe it\'s a bug, but I\'m posting here anyway.

I get the following issue on my local AppEngine testing server:

WARNING  2012-01-10 06:08:40,336 rdb         


        
相关标签:
6条回答
  • 2020-12-16 18:15

    In some cases, this error is caused by dev_appserver.py returning fail for the open call when the file name matches a skip_files pattern in app.yaml. Check app.yaml even when running dev_appserver.py locally.

    0 讨论(0)
  • 2020-12-16 18:25

    I have another answer to his problem, which I experienced by myself. If you have for example a templates directory like this:

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

    And your app.yaml file like this:

    - url: /templates
      static_dir: templates
    

    You are not able to render a template with jinja2 if you use this name:

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

    I think that's because the static_dir option somehow blocks this directory for jinja2, at least I think so, maybe it helps someone!

    0 讨论(0)
  • 2020-12-16 18:25

    Simply remove the file setuptools-0.6c11-py2.7.egg from your site packages.

    Find the location of your site packages

    Start python CLI:

    python
    

    List site packages:

    >>> import site; site.getsitepackages()
    
    0 讨论(0)
  • 2020-12-16 18:26

    Instead of referencing my variable using a hardcoded path variable, I'm now using:

    PROJECT_DIR = os.path.dirname(__file__)
    

    And it's working. I'll let you know if the issue comes back (I saw some articles describing it as being randomly recurrent).

    I also applied the patch in comment 29 on http://code.google.com/p/googleappengine/issues/detail?id=4339

    0 讨论(0)
  • 2020-12-16 18:27

    I have been puzzled by similar issue - IOError when importing an egg file / package from site-packages. I am using Ubuntu 13.10, GAE 1.8.8, virtualenv and python 2.7.

    In the end, I've worked out that I could not import anything that I installed using easy_install (which by defaults puts egg files into site_packages).

    Once I uninstalled all these eggs, and reinstalled using pip install command, everything started working normally.

    Hoping this will save someone else some time, as I will never get my wasted hours back.

    0 讨论(0)
  • 2020-12-16 18:35

    might be late but maybe would help someone else.
    so, when you add

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

    don't add
    - url: /templates static_dir: templates
    to your app.yaml file

    0 讨论(0)
提交回复
热议问题