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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T04:42:50+00:00 2026-06-07T04:42:50+00:00

I am running Python 2.7 (x64 Linux) and trying to convert a dict to

  • 0

I am running Python 2.7 (x64 Linux) and trying to convert a dict to a JSON object.

>>> import sys
>>> sys.version_info
sys.version_info(major=2, minor=7, micro=0, releaselevel='final', serial=0)

I am trying to use simplejson (falling back to json from the standard library) but I get the following error:

>>> try: import simplejson as json
... except ImportError: import json
...                  
>>> metadata = dict()
>>> metadata['foo'] = 'bar'
>>> print metadata
{'foo': 'bar'}
>>> json.dumps(metadata)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'dumps' 

Is there something obvious I am missing about using json or simplejson with Python 2.7?

  • 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-07T04:42:52+00:00Added an answer on June 7, 2026 at 4:42 am

    Turned out I had an old json library loaded from an old Python installation:

    >>> import json                                                                                                                                                                                                                                                                           
    >>> print json.__file__                                                                                                                                                                                                                                                                   
    /home/areynolds/opt/lib/python2.5/site-packages/json.pyc
    

    Removing that old stuff fixed the issue. Thanks!

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

Sidebar

Related Questions

I'm running Python 3.1 on Windows and I'm trying to distribute my Pygame script
I'm running Python 2.5.4 on Windows and I keep getting an error when trying
Im running mysql, pyodbc, python 2.7 loaded on Fedora 14 x64. Odbcinst.ini is: #
I'm running python 2.4 from cgi and I'm trying to upload to a cloud
I'm running Python 2.6.6 on Ubuntu 10.10. I understand that we can import a
I'm running Python 2.7, with the latest version of GTK installed. I'm trying to
I'm running python 2.6 on an Intel Mac OS X 10.5 I'm trying to
I'm running Windows 7 x64. I installed the 32x verson of Python 2.7.2 and
Running python on Snow Leopard, and I can't import the 'time' module. Works in
I'm trying to learn python but have some problem running source files from power

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.