-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Standardize gdal-utils scripts return codes #5561
Comments
sounds good. I had written initially "Any non-zero value is appropriate", but things seem more complex |
I've converted all the scripts that were using The
Stopping here for the moment. |
Most of the return The exceptions are:
Make graticule could be considered broken, in that without arguments it just goes ahead and does work and passing Create pdf script has me confused. I haven't been able to figure out where the return code is coming from at all. For instance this change in 1a34f9e still returns 0:
Seeking to understand what's happening I looked at other samples which use Sign me, scratching head. |
Looking at |
Good catch @EvertEt, thank you! Now I'll turn to studying how |
I couldn't figure out the arg parser class so I embarked on making everything else use |
I can help with the arg parser - please write your questions/issues.
…On Sat, 9 Apr 2022, 00:55 matt wilkie, ***@***.***> wrote:
I couldn't figure out the arg parser class so I embarked on making
everything else use 2 instead. I'm questioning the wisdom of that at the
moment since so many files are beng touched. However the process has forced
me to look more closely at the many scripts and start to internalize the
various patterns they use. This has been worthwhile even if the approach
might get abandoned. The effort is in branch patch-5561-ret2
<https://github.com/maphew/gdal/tree/patch-5561-ret2>
—
Reply to this email directly, view it on GitHub
<#5561 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AGJBBLO5EWUAZJZTEAI7MQLVEC2NHANCNFSM5SJG5TBA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
thanks @idanmiara. Here is the path I'm following. With
I get:
Digging in to pct2rgb.py I see main() calling PCT2RGB class, calling pct2rgb function, which should error out with an exception.:
So I'm thinking that while PCT2RGB class is invoking GDALArgumentParser it's exiting early somehow with this 2 return code.
I look at
So my question is: where is |
This was resolved on the mailing list, with the decision that Thread: https://www.mail-archive.com/gdal-dev@lists.osgeo.org/msg37730.html |
While building the autotests for pyscripts/gdal-utils one of the things that tripped me up for a bit was that the utils do not return the same status code for "was run without arguments". Some are
0
and others are-1
. It would be good for the same code meant the same thing across all the scripts in the package.At the moment I'm only thinking as far as 'no arguments'. I don't know if there are other codes worth trying to standardize on. "input not found" comes to mind, perhaps.
I'm willing to do the work, but do others think it's a good idea too?
cc @idanmiara, @rouault
The text was updated successfully, but these errors were encountered: