open-location-code icon indicating copy to clipboard operation
open-location-code copied to clipboard

Python needs to be ported to Python 3

Open SWalkerTTU opened this issue 5 years ago • 4 comments
trafficstars

As is, the Python module does not work in Python 3.7, and Python 2 will be officially deprecated in two weeks (1st January 2020). I have tried a number of things to get it to work, but to no avail.

SWalkerTTU avatar Dec 17 '19 07:12 SWalkerTTU

Hey @SWalkerTTU, our Python library already runs properly on Python 3.6 (tested continuously).

Do you have more details on what isn't working in Python 3.7? Could it be a configuration issue?

zongweil avatar Dec 27 '19 18:12 zongweil

I've narrowed it down a bit more. The code in the Git repository passes its test on 3.8, but importing the pip package in 3.8 isn't working; the methods don't show up with openlocationcode.dict on 3.8, but do on 2.7.

SWalkerTTU avatar Jan 12 '20 05:01 SWalkerTTU

@zongweil I was unable to resolve functions defined in openlocationcode after installing via pip and importing it in the standard way using import openlocationcode or from openlocationcode import *. Instead, I had to either...

  • use from openlocationcode.openlocationcode import * which seems less-than-idiomatic, or...
  • edit the __init__.py file of the package and change from openlocationcode import * to __all__ = ["openlocationcode"] and then import in the standard fashion: from openlocationcode import *

This is with 3.8.1. I haven't checked other versions.

socketbox avatar Feb 06 '20 12:02 socketbox

Recommended tag: implementation

fulldecent avatar Apr 25 '21 04:04 fulldecent