[gdal-dev] The proper way to call gdal "scripts" on Windows?

Idan Miara idan at miara.com
Thu Feb 25 01:53:53 PST 2021


Actually, it might be a good idea to use a batch file...

I've created the following batch file named gdal_calc.bat in the scripts
folder:
@python %~dp0\gdal_calc.py %*

Then running gdal_calc works even if *.py is associated with PyCharm.
Do you think this issue justifies creating this kind of batch files for the
scripts to distribute in binary windows wheels ?



On Thu, 25 Feb 2021 at 11:41, Richard Duivenvoorde <rdmailings at duif.net>
wrote:

> On 2/25/21 10:15 AM, Idan Miara wrote:
>
> > I guess that because I had `scripts` in my path I expected that `python
> gdal_calc.py` would also work (unrelated to which application is associated
> with py files), but it seems that it only works for files in the current
> dir or when providing a full path, and it doesn't work for files in the
> path (unless you cd to that dir).
> > Richard - I'm not sure which batch files you were referring to, which
> gdal distribution created gdal_calc.bat files for you?
>
> Hi Idan,
>
> no worries: I was just guessing. I'm a Linux user, but sometimes Windows
> user at clients..
>
> I thought to have seen that some Python packages install small 'bat-files
> in the Python Scripts folder, just to be able to call the actual python
> scripts.
>
> So I was guessing that on Windows there would be a gdal_calc.bat script to
> call the actual gdal_calc.py.. but apparently I was wrong ;-~
>
> Regards,
>
> Richard Duivenvoorde
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20210225/bec1017c/attachment.html>


More information about the gdal-dev mailing list