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 compatiability #2

Open
datapolitan opened this issue May 3, 2016 · 5 comments
Open

Python 3 compatiability #2

datapolitan opened this issue May 3, 2016 · 5 comments

Comments

@datapolitan
Copy link

Any chance this could work with Python 3? I have a student in class who can't use this because he isn't using Python 2.

pip install nyc-geoclient fails on the print statement in setup.py line 12. Not sure what else would go into making this work in Python 3.

@nygeog
Copy link

nygeog commented May 24, 2016

Could maybe have the student change that print code... print will be a function in python 3.

source:
http://stackoverflow.com/questions/826948/syntax-error-on-print-with-python-3

@fractalphile
Copy link

For what it's worth, in case anyone else is trying this, I found three things that needed changing to work with Python 3.4:

  1. The print statement in setup.py Line 15 needs parentheses.
  2. In api.py Line 9, import urlencode from urllib.parse instead of just urllib.
  3. Because iterating over dictionaries works differently in python 3 (see here), lines 53-55 don't work. I changed the original code
        # Ensure no 'None' values are sent to server
        for k in kwargs.keys():
            if kwargs[k] is None:
                kwargs.pop(k)

to:

        # Ensure no 'None' values are sent to server
        listOfNone = []
        for k in kwargs.keys():
            if kwargs[k] is None:
                listOfNone.append(k)
        for n in listOfNone:
            kwargs.pop(n)

and that seemed to work. With the caveat that I'm pretty inexperienced, so no guarantees!

@ResidentMario
Copy link

For future reference, if you need it I suggest using my fork.

@ishiland
Copy link

I incorporated some of the changes in previous PR's and added some tests.

If there is enough interest, I would be glad to put my fork on pypi and actively maintain it. I'm just not sure what an appropriate namespace for it is.

@ResidentMario
Copy link

I think that would be apropro, as this version of the library has been abandoned for quite a long time now. 😄

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

5 participants