Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python 3 Compatibility #3

Open
stevencox opened this issue Jan 21, 2017 · 0 comments
Open

Python 3 Compatibility #3

stevencox opened this issue Jan 21, 2017 · 0 comments

Comments

@stevencox
Copy link

stevencox commented Jan 21, 2017

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant