Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3238222
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T17:49:44+00:00 2026-05-17T17:49:44+00:00

I created a simple python project that serves up a couple of pages. I’m

  • 0

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.

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

If I let the django templating system to read the same file for me, everything works fine!

So the question is What am I doing wrong that django isn’t??? The same ‘pageUrl’ is used.

The code below will give me the error, while if I comment out the first pageContent assignment, everything works fine.

Code:

        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" 
                           }

Error:

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'

app.yaml:

handlers:
- url: /javascript
  static_dir: javascript

- url: /images
  static_dir: images

- url: /portfolio
  static_dir: portfolio

- url: /.*
  script: main.py
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T17:49:45+00:00Added an answer on May 17, 2026 at 5:49 pm

    os.path.normpath() on “content_includes” is a no-op – normpath just removes double slashes and other denormalizations. What you probably want is to build a path relative to the script, in which case you should do something like os.path.join(os.path.dirname(__file__), 'content_includes', pageName + '.inc').

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using python and CherryPy to create a simple internal website that about 2
I have created a simple python web site using Google App Engine. Currently, the
I have a simple, pure python project that I want to make available with
In the many Python applications I've created, I often create simple modules containing nothing
I am trying to create a simple Python module for MySQL Workbench 5.1.17 SE
I have been trying to create a simple program with Python which uses OpenCV
I've written a simple multi-threaded game server in python that creates a new thread
Could someone help me on this, I have created simple web services using axis2
I have a project idea, but unsure if using Python would be a good
I'm trying to find the instructions here to launch a Django project on Heroku.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.