gravitystorm / openstreetmap-carto

A general-purpose OpenStreetMap mapnik style, in CartoCSS
Other
1.51k stars 811 forks source link

Make get-external-data.py search relative to itself for external-data.yml #4892

Open pnorman opened 8 months ago

pnorman commented 8 months ago

When installing a server I noticed that get-external-data.py needs to be run from the osm-carto directory.

$ sudo -u _renderd /home/_renderd/openstreetmap-carto/scripts/get-external-data.py
INFO:root:Starting load of external data into database
Traceback (most recent call last):
  File "/home/_renderd/openstreetmap-carto/scripts/get-external-data.py", line 405, in <module>
    main()
  File "/home/_renderd/openstreetmap-carto/scripts/get-external-data.py", line 288, in main
    with open(opts.config) as config_file:
FileNotFoundError: [Errno 2] No such file or directory: 'external-data.yml'

The work-around is to switch directories, but this should not be necessary. The script should look relative to its location, not the current working directory.

imagico commented 8 months ago

We have, in general, not been consistent in that regard with our scripts: