2

I have a somewhat unique and frustrating situation. I need to do some JSON processing in Python, but with the following limitations:

  • I'm stuck with Python 2.4.3 (so no json module).
  • I can't install anything we don't currently have (so no old versions of simplejson).

My employer is a very large company, and I don't think I would have the ability to change either of the above issues with any speed. Do I have any options here besides doing all of my JSON processing manually, or switching to another language entirely?

9
  • 5
    simplejson can be used just like any other module, bundled with your project. Are you sure you cannot use it? You don't even have to compile the C extension (offering speedups). Commented Jul 16, 2014 at 19:39
  • The script I'm writing is going to be used on multiple machines, which may not have access to all of the same programs and Python modules (otherwise I could be using Python 2.6). I can see about adding it to our paths, but there isn't much guarantee it will work since I don't know if I can add it to all the necessary systems. Commented Jul 16, 2014 at 19:41
  • I mean you bundle it with your script. Commented Jul 16, 2014 at 19:43
  • 2
    Any module you put next to your script can be imported. The directory of your script is always added to the path, so if you put simplejson right next to the script it can be imported. Commented Jul 16, 2014 at 19:50
  • 1
    All previous releases are available on PyPI: pypi.python.org/simple/simplejson Commented Jul 16, 2014 at 19:56

1 Answer 1

1

The directory your script is run from is always added to the sys.path module search path, so you can just bundle simplejson with your script.

The current simplejson release can be used on Python 2.5 and up, but you can always find older releases in the PyPI simple index for the project.

Note that the project uses a C extension for speedups; not compiling it is fine but JSON loading and dumping will be slower.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.