title: Reading files in GAE using python
body: <p>I created a simple python project that serves up a couple of pages. I'm using the 'webapp' framework and django. What I'm trying to do is use one template file, and load 'content files' that contain the actual page text. </p>
  
  <p>When I try to read the content files using os.open, I get the following error:
  pageContent = os.open(pageUrl, 'r').read()
  OSError: [Errno 1] Operation not permitted: 'content_includes/home.inc' error</p>
  
  <p>If I let the django templating system to read the same file for me, everything works fine!</p>
  
  <p>So the question is What am I doing wrong that django isn't??? The same 'pageUrl' is used. </p>
  
  <p>The code below will give me the error, while if I comment out the first pageContent assignment, everything works fine. </p>
  
  <p>Code:</p>
  
  <pre>
          pageName = "home";
  
          pageUrl = os.path.join(os.path.normpath('content_includes'), pageName + '.inc')
          pageContent = os.open(pageUrl, 'r').read()
          pageContent=template.render(pageUrl, template_values, debug=True);
  
          template_values = { 'page': pageContent, 
                             'test': "testing my app" 
                             }
  </pre>
  
  <p>Error:</p>
  
  <pre>
  Traceback (most recent call last):
    File "/opt/apis/google_appengine/google/appengine/ext/webapp/__init__.py", line 511, in __call__
      handler.get(*groups)
    File "/home/odessit/Development/Python/Alpha/main.py", line 19, in get
      pageContent = os.open(pageUrl, 'r').read()
    File "/opt/apis/google_appengine/google/appengine/tools/dev_appserver.py", line 805, in FakeOpen
      raise OSError(errno.EPERM, "Operation not permitted", filename)
  OSError: [Errno 1] Operation not permitted: 'content_includes/home.inc'
  </pre>
  
  <p>app.yaml:</p>
  
  <pre>
  handlers:
  - url: /javascript
    static_dir: javascript
  
  - url: /images
    static_dir: images
  
  - url: /portfolio
    static_dir: portfolio
  
  - url: /.*
    script: main.py
  </pre>