[Osgeo4w-trac] [osgeo4w] #594: GDAL Python scripts can not be run
OSGeo4W
trac_osgeo4w at osgeo.org
Sun Feb 10 12:56:34 PST 2019
#594: GDAL Python scripts can not be run
--------------------------------+----------------------------
Reporter: alexbruy | Owner: osgeo4w-dev@…
Type: defect | Status: new
Priority: major | Component: Package
Version: | Resolution:
Keywords: gdal,python,scripts |
--------------------------------+----------------------------
Comment (by Mike Toews):
Generally speaking, calling `python script_name.py` should normally show
"python: can't open file 'script_name.py': [Errno 2] No such file or
directory", unless that file exists in the current directory.
With OSGeo4w's Shell, these commands are normally run by their name
without any extension:
{{{
C:\>gdal_calc
Usage: gdal_calc.py --calc=expression --outfile=out_filename [-A filename]
[--A_band=n] [-B...-Z filename] [other_options]
...
}}}
Internally, the Python scripts are usually run with a tiny BAT script,
e.g. see `where gdal_calc` for the full path of the thing that CMD calls:
{{{
C:\>where gdal_calc
C:\OSGeo4W64\bin\gdal_calc.bat
C:\>cat C:\OSGeo4W64\bin\gdal_calc.bat
@echo off
call "%OSGEO4W_ROOT%\bin\o4w_env.bat"
python "%OSGEO4W_ROOT%\bin\gdal_calc.py" %*
}}}
--
Ticket URL: <https://trac.osgeo.org/osgeo4w/ticket/594#comment:3>
OSGeo4W <http://trac.osgeo.org/osgeo4w>
OSGeo4W is the Windows installer and package environment for the OSGeo stack.
More information about the Osgeo4w-trac
mailing list