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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T06:04:34+00:00 2026-05-27T06:04:34+00:00

I am parsing a mustache file into a string, and after that I want

  • 0

I am parsing a mustache file into a string, and after that I want to process that string with the csv module. For that I generate a file like interface to the string using StringIO. The csv module is complaining with:

_csv.Error: line contains NULL byte

So I made a simple test:

import pystache
from cStringIO import StringIO

txt = pystache.render('Hello {{name}}', {'name' : 'Steve'})
f = StringIO(txt)
data = f.read()
print txt.find('\x00')
print data.find('\x00')
print txt.count('\x00')
print data.count('\x00')

Which produces:

-1
1
0
33

Somehow the StringIO object is inserting NULL bytes. This does not happen if I use a string which has not been pre-processed with pystache:

from cStringIO import StringIO

txt = "Hello Steve"
f = StringIO(txt)
data = f.read()
print txt.find('\x00')
print data.find('\x00')
print txt.count('\x00')
print data.count('\x00')

The result is as expected:

-1
-1
0
0

What could the problem be?

  • 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-27T06:04:35+00:00Added an answer on May 27, 2026 at 6:04 am

    txt = "Hello Steve" is a bytestring, could the preprocessed string be a unicode string?

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

Sidebar

Related Questions

I wrote a script parsing a .csv file in groovy using tokenize, which ended
Possible Duplicate: Parsing XML String in C# How to process the below XML file
When parsing an xml file in android, I'm doing like this: try { InputStream
I have a problem parsing a XML file which contains special characters like ,
Parsing a 20MB file that is too large to do in one piece on
Parsing some data and inserting it into 3 tables from .NET. Using Table Valued
After parsing my file s contains AttributeGet:1,16,10106,10111 So I need to get all the
When parsing XML like below, does book.xml need to be a static file of
I am using the Mustache templating library and trying to generate a comma separated
Parsing an XML file using the Java DOM parser results in: [Fatal Error] os__flag_8c.xml:103:135:

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.