Search code examples
pythonopenstreetmap

Python: Converting python2 to python3


I am trying to use

https://github.com/iandees/mongosm/blob/master/insert_osm_data.py

this package. It seems like it is written in Python2. I have converted all the way to next(context). However, I am getting name 'long' is not defined.

Is there any way that I can define this somewhere? How can I define 'long' and I have no idea what this is for even for Python2 Script (which worked fine somehow).


Solution

  • long() is basically renamend to int() in Python 3. Please see https://www.python.org/dev/peps/pep-0237/ for details.

    So, either do a search of long and replace with int, or define it

    long = int
    

    somewhere at the beginning of your file.