JSON and Firefox sessionstore.js

Steven D'Aprano steve at REMOVE-THIS-cybersource.com.au
Thu Apr 23 01:57:59 CEST 2009

Unless I'm badly mistaken, the Firefox sessionstore.js file is supposed 
to be JSON.

In Python 3.0, I do this:

>>> import json
>>> filename = '.mozilla/firefox/2z5po7dx.default/sessionstore.js'
>>> json.load(open(filename))
Traceback (most recent call last):
  File "/usr/local/lib/python3.0/json/decoder.py", line 340, in raw_decode
    obj, end = next(self._scanner.iterscan(s, **kw))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.0/json/__init__.py", line 267, in load
    parse_constant=parse_constant, **kw)
  File "/usr/local/lib/python3.0/json/__init__.py", line 307, in loads
    return _default_decoder.decode(s)
  File "/usr/local/lib/python3.0/json/decoder.py", line 323, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/local/lib/python3.0/json/decoder.py", line 342, in raw_decode
    raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded

Am I doing something wrong? Am I mistaken about sessionstore.js being 
JSON? Is there a bug in json?

If it matters, I'm using Firefox under Linux.


More information about the Python-list mailing list