Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Reading files with python and open()
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  8 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
warlock24  
View profile  
 More options Nov 7, 10:39 am
From: warlock24 <warloc...@gmail.com>
Date: Sat, 7 Nov 2009 07:39:03 -0800 (PST)
Local: Sat, Nov 7 2009 10:39 am
Subject: [Python] Reading files with python and open()
Hello

Could someone tell me why tis code does't work?

[CODE]
ROOT_DIR = os.path.dirname(__file__)
pageUrl = os.path.join(ROOT_DIR, 'pages/' + pageName + '.html')
pageContent = open(pageUrl, 'r').read()
[/CODE]

i get error message

[CODE]
IOError: [Errno 2] No such file or directory: '/base/data/home/apps/
warlock24/1.337586579904043005/pages/home.html'
[/CODE]

where are my files? :(


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Discussion subject changed to "[Python] Reading files with python and open()" by OvermindDL1
OvermindDL1  
View profile  
 More options Nov 7, 8:29 pm
From: OvermindDL1 <overmind...@gmail.com>
Date: Sat, 7 Nov 2009 18:29:10 -0700
Local: Sat, Nov 7 2009 8:29 pm
Subject: Re: [google-appengine] [Python] Reading files with python and open()

I would think that would work, but I cook everything in myself; you
might just try using a relative directory access instead of absolute,
I have heard that works best in GAE.

    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Discussion subject changed to "Reading files with python and open()" by warlock24
warlock24  
View profile  
 More options Nov 8, 5:20 am
From: warlock24 <warloc...@gmail.com>
Date: Sun, 8 Nov 2009 02:20:41 -0800 (PST)
Local: Sun, Nov 8 2009 5:20 am
Subject: Re: [Python] Reading files with python and open()
I found my file :D

but got another problem :/

pageContent = open(pageUrl, 'r').read()
IOError: [Errno 13] Permission denied: '/pages/home.html'

how do i set file permissions? Something i must do in YAML file?

On 8 Lis, 02:29, OvermindDL1 <overmind...@gmail.com> wrote:


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Discussion subject changed to "[Python] Reading files with python and open()" by Rodrigo Moraes
Rodrigo Moraes  
View profile  
 More options Nov 9, 3:27 am
From: Rodrigo Moraes <rodrigo.mor...@gmail.com>
Date: Mon, 9 Nov 2009 06:27:44 -0200
Local: Mon, Nov 9 2009 3:27 am
Subject: Re: [google-appengine] [Python] Reading files with python and open()

On Sat, Nov 7, 2009 at 1:39 PM, warlock24 <warloc...@gmail.com> wrote:
> [CODE]
> ROOT_DIR = os.path.dirname(__file__)
> pageUrl = os.path.join(ROOT_DIR, 'pages/' + pageName + '.html')
> pageContent = open(pageUrl, 'r').read()
> [/CODE]

Is the .html file mapped in app.yaml as static file? If it is, it
can't be read directly. If not, try using abspath:

ROOT_DIR = os.path.abspath(os.path.dirname(__file__))

-- rodrigo


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Discussion subject changed to "Reading files with python and open()" by Wooble
Wooble  
View profile  
 More options Nov 9, 9:06 am
From: Wooble <geoffsp...@gmail.com>
Date: Mon, 9 Nov 2009 06:06:19 -0800 (PST)
Local: Mon, Nov 9 2009 9:06 am
Subject: Re: Reading files with python and open()
You didn't find your file.  You're trying to read /pages at the root
of the filesystem, and you don't have permission to read anything
above your application directory.  The error isn't telling you that
you don't have permission to read it, it's that you don't even have
permission to check for its existence.

On Nov 8, 5:20 am, warlock24 <warloc...@gmail.com> wrote:


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
风笑雪  
View profile  
 More options Nov 9, 9:26 am
From: 风笑雪 <kea...@gmail.com>
Date: Mon, 9 Nov 2009 22:26:10 +0800
Local: Mon, Nov 9 2009 9:26 am
Subject: Re: [google-appengine] Re: Reading files with python and open()
Hi, please make sure the pages dir is NOT a static dir.

Static files are in different place with your script files, they can't
be accessed by your script.

2009/11/9 Wooble <geoffsp...@gmail.com>:


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Gezim Hoxha  
View profile  
 More options Nov 9, 10:17 pm
From: Gezim Hoxha <hge...@gmail.com>
Date: Mon, 9 Nov 2009 20:17:12 -0700
Local: Mon, Nov 9 2009 10:17 pm
Subject: Re: [google-appengine] Re: Reading files with python and open()

On Mon, Nov 9, 2009 at 7:06 AM, Wooble <geoffsp...@gmail.com> wrote:

> You didn't find your file.  You're trying to read /pages at the root
> of the filesystem, and you don't have permission to read anything
> above your application directory.  The error isn't telling you that
> you don't have permission to read it, it's that you don't even have
> permission to check for its existence.

Why then would he be getting this error in the other scenario with an
absolute URL:
"IOError: [Errno 2] No such file or directory: '/base/data/home/apps/"

Gezim Hoxha (aka Gizmo)
http://www.gizmobooks.com -- buy/sell your textbooks


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Wooble  
View profile  
 More options Nov 10, 10:36 am
From: Wooble <geoffsp...@gmail.com>
Date: Tue, 10 Nov 2009 07:36:07 -0800 (PST)
Local: Tues, Nov 10 2009 10:36 am
Subject: Re: Reading files with python and open()
That's not a permissions error; that one is where he's trying to read
from his application directory (which is allowed), but the file's not
there.  Almost certainly it's specified as a static file in app.yaml;
these are not copied to the application directory but are served from
different servers.

On Nov 9, 10:17 pm, Gezim Hoxha <hge...@gmail.com> wrote:


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google