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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T22:27:29+00:00 2026-06-13T22:27:29+00:00

Code: body = ‘%s’ % message.get_body() logging.error(body) parsed_body = json.loads(body) Body contains: [{u’content’: u’Test\r\n’,

  • 0

Code:

                body = '%s' % message.get_body()
                logging.error(body)
                parsed_body = json.loads(body)

Body contains:

[{u’content’: u’Test\r\n’, u’body_section’: 1, u’charset’: u’utf-8′, u’type’: u’text/plain’}, {u’content’: u’Test\r\n’, u’body_section’: 2, u’charset’: u’utf-8′, u’type’: u’text/html’}]

Error:

line 67, in get
    parsed_body = json.loads(body)
  File "C:\Python27\lib\json\__init__.py", line 326, in loads
    return _default_decoder.decode(s)
  File "C:\Python27\lib\json\decoder.py", line 366, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "C:\Python27\lib\json\decoder.py", line 382, in raw_decode
    obj, end = self.scan_once(s, idx)
  File "C:\Python27\lib\json\decoder.py", line 38, in errmsg
    lineno, colno = linecol(doc, pos)
TypeError: 'NoneType' object is not callable

Anybody know what’s wrong?

  • 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-13T22:27:31+00:00Added an answer on June 13, 2026 at 10:27 pm

    body is a string (you get it with ‘%s’ % …), so it shouldn’t contain Python string-encoding such as u'content'.

    This means that either get_body() returns a complex object, and '%s' % ... is converting it into a python-output string which is not JSON, or something is already “fixing” the string when get_body returns it. The error is then elsewhere.

    Example:

    import json
    
    # This is a correct JSON blob
    
    body = '[{"content": "Test\\r\\n", "body_section": 1, "charset": "utf-8", "type": "text/plain"}, {"content": "Test\\r\\n", "body_section": 2
    , "charset": "utf-8", "type": "text/html"}]'
    
    # And this is a correct object
    data = json.loads(body)
    
    # If I were to print this object into a string, I would get 
    # [{u'content': u'Test\r\n', u'type': u'text/plain', u'charset'...
    # and a subsequent json.load would fail.
    
    # Remove the comment to check whether the error is the same (it is not on
    # my system, but I'm betting it depends on JSON implementation and/or python version)
    
    # body = '%s' % data
    
    print body
    
    print json.loads(body)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following jQuery code: $(body.page-calendar-practices-2012-05 #content-header h1#title) which works fine. I can
I have this code $(body).on({ click: function(event){ event.preventDefault(); var aLink = $(this).attr(href); $(#content).load(aLink+ #loader,
CSS code body { background-attachment: scroll; background-clip: border-box; background-color: #ececec; background-image: none; background-origin: padding-box;
This is my code: $('body').css('cursor','url(http://5211.91.tc/imcur/020.cur),auto'); Thanks
I have this background, the css code is: body { background: #FFF url('images/bg.png') no-repeat
I've a simple html page with no code in the body tag. I want
I have a method called ReadTill that has the same body of code but
In my erb file, I have the following code in the body tag: <%
This code should i place this code at bottom of body it's in conditional
Consider the following code: $(document).ready(function() { $(body).append(<div class='outer'><span class='inner'>Click me</span></div>); $(html).click(function(event) { var targetClass

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.