[osgeo4w] #594: GDAL Python scripts can not be run

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

[osgeo4w] #594: GDAL Python scripts can not be run

OSGeo4W
#594: GDAL Python scripts can not be run
---------------------+---------------------------------
Reporter:  alexbruy  |      Owner:  osgeo4w-dev@…
    Type:  defect    |     Status:  new
Priority:  major     |  Component:  Package
 Version:            |   Keywords:  gdal,python,scripts
---------------------+---------------------------------
 Looks like there is something wrong with GDAL Python scripts (e.g.
 gdal_merge.py, gdal_calc.py etc) setup in OSGeo4W.

 When trying to run any of the Processing tools in QGIS which are based on
 GDAL Python scripts, they fails with message saying that corresponding
 GDAL script is not found. Same happens with trying to run them from the
 OSGeo4W shell directly.

 Here is steps to reproduce using OSGeo4W shell:
 1. open OSGeo4W shell
 2. setup Python by running py3_env.bat
 3. try to execute for example gdal_calc.py with
 {{{
 python gdal_calc.py
 }}}
 4. execution failed with error
 {{{
 C:\>python gdal_calc.py
 (null): can't open file 'gdal_calc.py': [Errno 2] No such file or
 directory
 }}}

 Same error when running gdal_calc.py from QGIS Processing.

 Related QGIS issue https://issues.qgis.org/issues/21210

--
Ticket URL: <https://trac.osgeo.org/osgeo4w/ticket/594>
OSGeo4W <http://trac.osgeo.org/osgeo4w>
OSGeo4W is the Windows installer and package environment for the OSGeo stack.

_______________________________________________
osgeo4w-dev mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/osgeo4w-dev
Reply | Threaded
Open this post in threaded view
|

Re: [osgeo4w] #594: GDAL Python scripts can not be run

OSGeo4W
#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 jef):

 Did you install python3-gdal?

--
Ticket URL: <https://trac.osgeo.org/osgeo4w/ticket/594#comment:1>
OSGeo4W <http://trac.osgeo.org/osgeo4w>
OSGeo4W is the Windows installer and package environment for the OSGeo stack.

_______________________________________________
osgeo4w-dev mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/osgeo4w-dev
Reply | Threaded
Open this post in threaded view
|

Re: [osgeo4w] #594: GDAL Python scripts can not be run

OSGeo4W
In reply to this post by OSGeo4W
#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 alexbruy):

 Yes, python3-gdal 2.4.0-5 installed, GDAL scripts present in the
 %OSGEO4W_ROOT%\apps\Python37\Scripts and can be executed when full path
 specified.

--
Ticket URL: <https://trac.osgeo.org/osgeo4w/ticket/594#comment:2>
OSGeo4W <http://trac.osgeo.org/osgeo4w>
OSGeo4W is the Windows installer and package environment for the OSGeo stack.

_______________________________________________
osgeo4w-dev mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/osgeo4w-dev
Reply | Threaded
Open this post in threaded view
|

Re: [osgeo4w] #594: GDAL Python scripts can not be run

OSGeo4W
In reply to this post by OSGeo4W
#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.

_______________________________________________
osgeo4w-dev mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/osgeo4w-dev
Reply | Threaded
Open this post in threaded view
|

Re: [osgeo4w] #594: GDAL Python scripts can not be run

OSGeo4W
In reply to this post by OSGeo4W
#594: GDAL Python scripts can not be run
--------------------------------+----------------------------
Reporter:  alexbruy             |       Owner:  osgeo4w-dev@…
    Type:  defect               |      Status:  closed
Priority:  major                |   Component:  Package
 Version:                       |  Resolution:  worksforme
Keywords:  gdal,python,scripts  |
--------------------------------+----------------------------
Changes (by jef):

 * status:  new => closed
 * resolution:   => worksforme


Comment:

 The QGIS problem is fixed by running "python -m gdal_calc …"

--
Ticket URL: <https://trac.osgeo.org/osgeo4w/ticket/594#comment:4>
OSGeo4W <http://trac.osgeo.org/osgeo4w>
OSGeo4W is the Windows installer and package environment for the OSGeo stack.

_______________________________________________
osgeo4w-dev mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/osgeo4w-dev