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

  • Home
  • SEARCH
  • 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 6836627
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T23:22:41+00:00 2026-05-26T23:22:41+00:00

class PDF(webapp.RequestHandler): def get(self): self.response.headers[‘Content-Type’] = application/txt self.response.headers[‘Content-Disposition’] = attachment; filename=file.pdf f = open(‘/Users/BP/file.pdf’,

  • 0
class PDF(webapp.RequestHandler):
    def get(self):
        self.response.headers['Content-Type'] = "application/txt"
        self.response.headers['Content-Disposition'] = "attachment; filename=file.pdf"
        f = open('/Users/BP/file.pdf', 'r')
        self.response.out.write(f.read())
def main():
    application = webapp.WSGIApplication([('/download', PDF)],
                                        debug=False)
    util.run_wsgi_app(application)

I get this error when I try to download it:

[Errno 13] Permission denied: '/Users/BP/file.pdf'
Traceback (most recent call last):
  File "/base/python_runtime/python_lib/versions/1/google/appengine/ext/webapp/_webapp25.py", line 701, in __call__
    handler.get(*groups)
  File "/base/data/home/apps/s~projectname/1.354763951774324185/main.py", line 43, in get
    f = open('/Users/BP/file.pdf', 'r')
IOError: [Errno 13] Permission denied: '/Users/BP/file.pdf'

Even though I’ve tried the chmod a+r file.pdf
Help please. Thank you!

  • 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-26T23:22:42+00:00Added an answer on May 26, 2026 at 11:22 pm

    os.path.dirname(__file__) gives you the application directory.

    f = open(os.path.dirname(__file__) + /'BP/file.pdf', r)

    Store your file in BP/ folder inside the main folder.

    @Nicke, @Jon: GAE allows access to your files. “May the source be with you”.

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

Sidebar

Related Questions

I'm using UIPrintPageRenderer sub-class to print html content on a pdf. How can i
I have a class that generates PDF with Prawn: class CustomersReport < Prawn::Document def
I'm building a pdf document with reportlab, using the Paragraph class: doc = SimpleDocTemplate(response,
I have written an apex class that will create a PDF quote and attach
class mineTest { string pdfTemplate = @c:\us.pdf; public mineTest(Customer c, string output) { StreamReader
I used the FPDF class to create a multi-page PDF document and then I
I'm currently building a class in PHP that generates PDF documents using the WKHTMLTOPDF
To send pdf files (or any other file type) to the browser, I've seen
I'm working on creating PDF files in PHP with the R&OS PDF class (
i am using html2pdf class to generate pdf. in my problem its generate pdf

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.