Skip to content
This repository was archived by the owner on Mar 23, 2026. It is now read-only.
This repository was archived by the owner on Mar 23, 2026. It is now read-only.

Python 3 Compatibility #3

@stevencox

Description

@stevencox

FYI, I was able to use this repo with Python 3 by changing these changes:

  1. imports
#from cStringIO import StringIO                                                                                                                                                                                                               
try:
    from StringIO import StringIO
except ImportError:
    from io import StringIO

import datetime
import urllib
#import urlparse                                                                                                                                                                                                                              
import urllib.parse as urllib
  1. unicode -> str
        elif response['content-type'].startswith('application/sparql-results+json'):
            # See http://stackoverflow.com/a/19366580/2276263                                                                                                                                                                                 
            # for justification of unicode() below                                                                                                                                                                                            
#            return simplejson.loads(unicode(content, "utf-8"))                                                                                                                                                                               
            return simplejson.loads(str(content, "utf-8"))

Relatively untested, but potentially helpful as a start.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions