It worked, thank you! El jue., 11 jul. 2019 a las 16:01, Daniel Patterson via OSRM-talk (< osrm-talk@openstreetmap.org>) escribió:
> I would recommend reading up on how the `subprocess.run()` function works > in Python. Based on the error, it looks like you need to do: > > subprocess.run(["docker","run","-t","-v", "%s:/data" % os.getcwd(), > "osrm/osrm-backend", "osrm-extract", "-p", "/opt/car.lua", > "/data/berlin-latest.osm.pbf"]) > > Note how I split the `osrm-extract` parameter into parts in this second > version - that's what the error message is complaining about. I don't use > python all that often, so YMMV here. > > daniel > > On Thu, Jul 11, 2019 at 1:31 AM Silvia Oviedo <siljuov...@gmail.com> > wrote: > >> Thank you for the suggestion. however I get : >> >> /usr/local/bin/docker: Error response from daemon: OCI runtime create >> failed: container_linux.go:344: starting container process caused "exec: >> \"osrm-extract -p /opt/car.lua /data/berlin-latest.osm.pbf\": stat >> osrm-extract -p /opt/car.lua /data/berlin-latest.osm.pbf: no such file or >> directory": unknown. >> >> I do have data/berlin-latest.osm.pbf in the working directory. Also, >> could you explain what "%s:/data" does exactly? >> >> Thank you >> >> El mié., 10 jul. 2019 a las 18:58, Daniel Patterson via OSRM-talk (< >> osrm-talk@openstreetmap.org>) escribió: >> >>> It'd be something like this (untested): >>> >>> subprocess.run(["docker","run","-t","-v", "%s:/data" % os.getcwd(), >>> "osrm/osrm-backend", "osrm-extract -p /opt/car.lua >>> /data/berlin-latest.osm.pbf"]) >>> >>> daniel >>> >>> On Wed, Jul 10, 2019 at 7:22 AM Silvia Oviedo <siljuov...@gmail.com> >>> wrote: >>> >>>> >>>> Hi all, >>>> >>>> I would like to run the pre-process of the car profile from a python >>>> script. I have checked the documentation of subprocess library and docker >>>> SDK for python but I don´t know how to properly make the request. For >>>> example, how could I transform the sh request: >>>> >>>> docker run -t -v "${PWD}:/data" osrm/osrm-backend osrm-extract -p >>>> /opt/car.lua /data/berlin-latest.osm.pbf >>>> >>>> So it can be done from python. Is that possible? >>>> >>>> >>>> Thank you in advance >>>> >>>> _______________________________________________ >>>> OSRM-talk mailing list >>>> OSRM-talk@openstreetmap.org >>>> https://lists.openstreetmap.org/listinfo/osrm-talk >>>> >>> _______________________________________________ >>> OSRM-talk mailing list >>> OSRM-talk@openstreetmap.org >>> https://lists.openstreetmap.org/listinfo/osrm-talk >>> >> >> >> -- >> Silvia Oviedo Castillo >> _______________________________________________ >> OSRM-talk mailing list >> OSRM-talk@openstreetmap.org >> https://lists.openstreetmap.org/listinfo/osrm-talk >> > _______________________________________________ > OSRM-talk mailing list > OSRM-talk@openstreetmap.org > https://lists.openstreetmap.org/listinfo/osrm-talk > -- Silvia Oviedo Castillo
_______________________________________________ OSRM-talk mailing list OSRM-talk@openstreetmap.org https://lists.openstreetmap.org/listinfo/osrm-talk