Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

g.download.location: Print target path in error message #4155

Merged
merged 4 commits into from
Aug 19, 2024

Conversation

neteler
Copy link
Member

@neteler neteler commented Aug 8, 2024

To be less obscure in case the target location directory already exists:

ERROR: Location named <nc_spm_full_v2alpha2> already exists, download
       canceled

this PR improves the error message to include the path:

g.download.location url=https://grass.osgeo.org/sampledata/north_carolina/nc_spm_full_v2alpha2.tar.gz path=$HOME
ERROR: Location named <nc_spm_full_v2alpha2> already exists in
       </home/mneteler/nc_spm_full_v2alpha2>, download canceled

This is esp. relevant for scripted usage when the command isn't invoked directly by the user.

In addition, section of EXAMPLES added.

To be less obscure (seen in addons CI log):

```
ERROR: Location named <nc_spm_full_v2alpha2> already exists, download
       canceled
```

where actually the existing Location is, this PR improves the error message:

```
g.download.location url=https://grass.osgeo.org/sampledata/north_carolina/nc_spm_full_v2alpha2.tar.gz path=$HOME
ERROR: Location named <nc_spm_full_v2alpha2> already exists in
       </home/mneteler/nc_spm_full_v2alpha2>, download canceled
```
@neteler neteler added enhancement New feature or request Python Related code is in Python general labels Aug 8, 2024
@neteler neteler added this to the 8.5.0 milestone Aug 8, 2024
@neteler neteler self-assigned this Aug 8, 2024
@github-actions github-actions bot added HTML Related code is in HTML module docs labels Aug 8, 2024
@neteler
Copy link
Member Author

neteler commented Aug 8, 2024

(I came across this issue while locally testing https://github.com/OSGeo/grass-addons/blob/grass8/.github/workflows/test.sh)

@wenzeslaus wenzeslaus changed the title g.download.location: print target path in error message g.download.location: Print target path in error message Aug 9, 2024
Co-authored-by: Vaclav Petras <wenzeslaus@gmail.com>
@echoix
Copy link
Member

echoix commented Aug 13, 2024

Slightly related, but the same problem: I read the docs of g.download.location the other day, and it seems there isn't a way to either download if missing, or to not fail if the same dataset already exists.

If it was possible, it would allow for example to use the script test_thorough.sh in the CI, and run it locally multiple times, instead of being able to run it once, then to adapt and only copy the second invocation.

At least this PR improves by showing more info as to where the data already exists.

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Copy link
Contributor

@veroandreo veroandreo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NC sample datasets are projects. I'd avoid calling them databases since usually the grassdata folder (a folder of projects) is called database. Also included a suggestion for @wenzeslaus' comment.

scripts/g.download.location/g.download.location.html Outdated Show resolved Hide resolved
scripts/g.download.location/g.download.location.html Outdated Show resolved Hide resolved
Co-authored-by: Veronica Andreo <veroandreo@gmail.com>
@echoix echoix merged commit a4257a1 into OSGeo:main Aug 19, 2024
26 checks passed
@neteler neteler deleted the g_download_location_target_path branch August 20, 2024 09:20
petrasovaa pushed a commit that referenced this pull request Aug 22, 2024
* g.download.location: print target path in error message

To be less obscure in case the target location directory already exists:

```
ERROR: Location named <nc_spm_full_v2alpha2> already exists, download
       canceled
```

this PR improves the error message to include the path:

```
g.download.location url=https://grass.osgeo.org/sampledata/north_carolina/nc_spm_full_v2alpha2.tar.gz path=$HOME
ERROR: Location named <nc_spm_full_v2alpha2> already exists in
       </home/mneteler/nc_spm_full_v2alpha2>, download canceled
```

This is esp. relevant for scripted usage when the command isn't invoked directly by the user.

In addition, section  of **EXAMPLES** added.

* fix message format

Co-authored-by: Vaclav Petras <wenzeslaus@gmail.com>

* database -> project

Co-authored-by: Veronica Andreo <veroandreo@gmail.com>

---------

Co-authored-by: Vaclav Petras <wenzeslaus@gmail.com>
Co-authored-by: Veronica Andreo <veroandreo@gmail.com>
@petrasovaa petrasovaa modified the milestones: 8.5.0, 8.4.1 Aug 22, 2024
landam pushed a commit to landam/grass that referenced this pull request Aug 22, 2024
* g.download.location: print target path in error message

To be less obscure in case the target location directory already exists:

```
ERROR: Location named <nc_spm_full_v2alpha2> already exists, download
       canceled
```

this PR improves the error message to include the path:

```
g.download.location url=https://grass.osgeo.org/sampledata/north_carolina/nc_spm_full_v2alpha2.tar.gz path=$HOME
ERROR: Location named <nc_spm_full_v2alpha2> already exists in
       </home/mneteler/nc_spm_full_v2alpha2>, download canceled
```

This is esp. relevant for scripted usage when the command isn't invoked directly by the user.

In addition, section  of **EXAMPLES** added.

* fix message format

Co-authored-by: Vaclav Petras <wenzeslaus@gmail.com>

* database -> project

Co-authored-by: Veronica Andreo <veroandreo@gmail.com>

---------

Co-authored-by: Vaclav Petras <wenzeslaus@gmail.com>
Co-authored-by: Veronica Andreo <veroandreo@gmail.com>
Mahesh1998 pushed a commit to Mahesh1998/grass that referenced this pull request Sep 19, 2024
* g.download.location: print target path in error message

To be less obscure in case the target location directory already exists:

```
ERROR: Location named <nc_spm_full_v2alpha2> already exists, download
       canceled
```

this PR improves the error message to include the path:

```
g.download.location url=https://grass.osgeo.org/sampledata/north_carolina/nc_spm_full_v2alpha2.tar.gz path=$HOME
ERROR: Location named <nc_spm_full_v2alpha2> already exists in
       </home/mneteler/nc_spm_full_v2alpha2>, download canceled
```

This is esp. relevant for scripted usage when the command isn't invoked directly by the user.

In addition, section  of **EXAMPLES** added.

* fix message format

Co-authored-by: Vaclav Petras <wenzeslaus@gmail.com>

* database -> project

Co-authored-by: Veronica Andreo <veroandreo@gmail.com>

---------

Co-authored-by: Vaclav Petras <wenzeslaus@gmail.com>
Co-authored-by: Veronica Andreo <veroandreo@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs enhancement New feature or request general HTML Related code is in HTML module Python Related code is in Python
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants