Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Reading and uploaded csv file
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
  1 message - 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
 
Alex  
View profile  
 More options Oct 8, 11:37 am
From: Alex <metallourla...@gmail.com>
Date: Thu, 8 Oct 2009 08:37:51 -0700 (PDT)
Local: Thurs, Oct 8 2009 11:37 am
Subject: Reading and uploaded csv file
Hi all.

I'm working on a small webapp with cherrypy that read an uploaded CSV
file and transform it in XML.
Now my problem is that when I try to read the content of the uploaded
file with csv.reader the file seams to be empty, but when I look at
the content with myFile.file.read() I can see the expected content.
So how can I use the csv module to read and uploaded file?

Thanks in advance.

Here is the relevant part of the code (mostly taken from the
tutorial).

class FileDemo(object):

    def index(self):
        return """
        <html><body>
            <form action="upload" method="post" enctype="multipart/
form-data">
            filename: <input type="file" name="myFile" /><br />
            <input type="submit" />
            </form>
        </body></html>
        """
    index.exposed = True

    def upload(self, myFile):
        out = """<html>
        <body>
                %s
        </body>
        </html>"""

       csvfile = csv.reader(myFile.file) # when I look in th csvfile
it seams there are no rows
      content = myFile.file.read()        # here I can see the
expected content

....


    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