Open ughur-a opened 1 day ago
In the beginning of this Python script I read
debug: bool = False
Thus, it requires a standard Python boolean value True or False, but a few other alternatives work as well https://www.w3schools.com/python/python_booleans.asp.
Yes, I've seen that as well. But from I've gathered the, the arguments to the function are not the raw arguments passed to the command line - rather, the command line arguments first get parsed by GDALArgumentParser
(see here), and it then passes the result to the actual function. And I guess GDALArgumentParser is the one that expects ints
Interesting, --quiet is configured in the same way but gdal_calc --quiet
does not complain.
parser.add_argument(
"--debug",
dest="debug",
action="store_true",
help="print debugging information",
)
parser.add_argument(
"--quiet",
dest="quiet",
action="store_true",
help="suppress progress messages"
Interesting, --quiet is configured in the same way but
gdal_calc --quiet
does not complain.
--debug is handled by generic GDAL parsing argument code, before the rest of gdal_calc has a chance to see it
What is the bug?
the help page gdal_calc lists a
--debug
option, but says that it requires no arguments. In reality however, it seems to require a int value passed - the more sensible options being0
,1
(buttrue
andfalse
also work)Steps to reproduce the issue
returns
ERROR 1: --debug option given without debug level.
Passing
--debug
before another option results in a cryptic error message:returns:
gdal_calc.py: error: argument --B_band: invalid int value: 'baz'
Versions and provenance
OS: Windows 11 GDAL version: GDAL 3.9.3, released 2024/10/07 (the newest available version) Source of the GDAL binary: OSGeo4W
Additional context
No response