[GRASS-git] [OSGeo/grass] c30d63: g.extension: catch missing modules.xml error (#2058)

Markus Neteler noreply at github.com
Sat Jan 1 07:53:42 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/OSGeo/grass
  Commit: c30d632c20e7b8519c834fc2b4c4d15d14bf3231
      https://github.com/OSGeo/grass/commit/c30d632c20e7b8519c834fc2b4c4d15d14bf3231
  Author: Markus Neteler <neteler at gmail.com>
  Date:   2022-01-01 (Sat, 01 Jan 2022)

  Changed paths:
    M scripts/g.extension/g.extension.py

  Log Message:
  -----------
  g.extension: catch missing modules.xml error (#2058)

* g.extension: catch error missing modules.xml

Print error message when
 https://grass.osgeo.org/addons/grass8/modules.xml
is missing on server.

So far this error appeared:

```
GRASS nc_spm_08_grass7/user1:grass_main > g.extension -l
...
Fetching list of extensions from GRASS-Addons SVN repository (be
patient)...
https://grass.osgeo.org/addons/grass8/
Traceback (most recent call last):
  File "/home/mneteler/software/grass80/dist.x86_64-pc-linux-gnu/scripts/g.extension", line 682, in list_available_modules
    tree = etree_fromurl(file_url)
  File "/home/mneteler/software/grass80/dist.x86_64-pc-linux-gnu/scripts/g.extension", line 384, in etree_fromurl
    file_ = urlopen(url)
...
  File "/usr/lib64/python3.10/urllib/request.py", line 643, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 404: Not Found
...
```

With this PR:

```
GRASS nc_spm_08_grass7/user1:grass_main > g.extension -l
/home/mneteler/software/grass80/dist.x86_64-pc-linux-gnu/scripts/g.extension:167: DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives
  from distutils.dir_util import copy_tree
List of available extensions (modules):
ERROR: Download file from
       <https://grass.osgeo.org/addons/grass8/modules.xml>, failed. File
       not on server or check internet connection.
```




More information about the grass-commit mailing list