Git Product home page Git Product logo

Comments (5)

phibos avatar phibos commented on May 30, 2024 2

Thanks for reporting the issue.

I have merged a fix into the master branch and it will be in the next release.

from python-overpy.

kxv avatar kxv commented on May 30, 2024

This is true for Python 2.7, too.

from python-overpy.

phibos avatar phibos commented on May 30, 2024

Looks like the reason for the issues are the lambda functions used as attribute_modifiers

from python-overpy.

wottpal avatar wottpal commented on May 30, 2024

(kindly asking 4 years later) will there ever be a "next release"? really need that fix :) thanks!

Update: For all others coming here, I've found a way using @phibos fix without a new version:

python -m pip uninstall overpy  
python -m pip install --upgrade git+git://github.com/DinoTools/python-overpy.git
Collecting git+git://github.com/DinoTools/python-overpy.git

from python-overpy.

peci1 avatar peci1 commented on May 30, 2024

Here's our workaround for Python 2.7:

import overpy
import pickle

op = overpy.Overpass()
sample = op.query("""
    way(50.746,7.154,50.748,7.157) ["highway"];
    (._;>;);
    out body;
    """)

def make_overpy_picklable(data):
    if hasattr(data, '_attribute_modifiers'):
        data._attribute_modifiers = None
    return data


def make_overpy_result_picklable(sample):
    sample = make_overpy_picklable(sample)
    for i in range(len(sample.nodes)):
        sample.nodes[i] = make_overpy_picklable(sample.nodes[i])
    for i in range(len(sample.ways)):
        sample.ways[i] = make_overpy_picklable(sample.ways[i])
    for i in range(len(sample.areas)):
        sample.areas[i] = make_overpy_picklable(sample.areas[i])
    for i in range(len(sample.relations)):
        sample.relations[i] = make_overpy_picklable(sample.relations[i])
    return sample

sample = make_overpy_result_picklable(sample)

with open('sample.pcl', 'wb') as pcl:
    pickle.dump(sample, pcl)

Deleting the dictionary is not a problem as it is only needed in the constructor.

from python-overpy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.