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 9270779
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T15:27:16+00:00 2026-06-18T15:27:16+00:00

I am using GAE to host a website which needs inputs from a CSV

  • 0

I am using GAE to host a website which needs inputs from a CSV file. After this csv file has been uploaded, I will convert it to a table. However, I met the problem about Mac and Windows compatibility issue. The CSV file generated in Mac will not be recognized, and I got the error:

new-line character seen in unquoted field - do you need to open the file in universal-newline mode?

Here is my
Python CODE

def loop_html(thefile):
    reader = csv.reader(thefile.file)   
    header = reader.next()
    i=1
    iter_html=""
    for row in reader:
        iter_html = iter_html +html_table(row,i)  #generate inputs table
        i=i+1

def html_table(row_inp,iter):
    mai_temp=float(row_inp[0])

    Input_header="""<table border="1">
                        <tr><H3>Batch Calculation of Iteration %s</H3></tr><br>
                        <tr>
                            <td><b>Input Name</b></td>
                            <td><b>Input value</b></td>
                            <td><b>Unit</b></td>
                        </tr>"""%(iter)
    Input_mai="""<tr>
                    <td>Mass of Applied Ingredient Applied to Paddy</td>
                    <td>%s</td>
                    <td>kg</td>
                </tr>""" %(mai_temp) 
    Inout_table = Input_header+Input_mai
    return Inout_table  

Later I changed the code ‘reader = csv.reader(thefile.file) ‘ to
‘reader = csv.reader(open(thefile.file,’U’)) ‘ which gave me different types of error:

TypeError: coercing to Unicode: need string or buffer, cStringIO.StringO found

Can anyone take a look at my code and give me some suggestions? Thanks!

  • 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-06-18T15:27:18+00:00Added an answer on June 18, 2026 at 3:27 pm

    I just found a solution. ‘splitlines()’ will handle the new line issue. Here is the source.

    reader = csv.reader(thefile.file.read().splitlines())
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using GAE with python and I came across this problem, I'm trying to
I am using GAE's high replication datastore. I previously downloaded a table in csv
I'm using GAE[JAVA] to do some image processing. GAE will not allow write file
I'm trying to get Django running on GAE using this tutorial . When I
I've been using GAE for months now, but very recently I've had difficulty getting
I want to create a process using GAE by which, given a url, a
I have been working on an application using GAE in eclipse and I have
I want to send XMPP message from my android client to GAE Server using
I'm using GAE memcache to fetch a boolean on each request. This boolean is
I've been using GAE XMPP however and have tried working with external XMPP server

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.