[Qgis-user] osgeo4w shell gdal_calc not running

karsten karsten at terragis.net
Thu Feb 25 21:41:37 PST 2021


Hi All,
 
I was able to fix this by adding to both PATH and PYTHONPATH environment variables  the dir c:\OSGeo4W64\bin . 
It now works if I specify the full path to the python file as
 
python c:\OSGeo4W64\bin\gdal_calc.py
 
but not when calling it as gdal_calc (gives and error that the file is not found)
even though that directory is on the PATH and PYTHONPATH as well... 
At least I can run it this way again now
 
Cheers
Karsten

  _____  

From: karsten [mailto:karsten at terragis.net] 
Sent: Thursday, February 25, 2021 19:36
To: 'Nicolas Cadieux'
Cc: 'QGIS User'
Subject: RE: [Qgis-user] osgeo4w shell gdal_calc not running


Hi Nicolas,
 
thanks. I tried that route and removed all user folder references to osgeo4w and qgis, then deinstalled and removed osgeo4w completely , and reinstalled osgeo4w.
 
I still have a problem (and also on a  second machine on windows 10 the same)
though it is now a different error message:
 
Fatal Python error: initfsencoding: unable to load the file system codec
  File "C:\OSGEO4~1\apps\Python27\lib\encodings\__init__.py", line 123
    raise CodecRegistryError,\
                            ^
SyntaxError: invalid syntax
Current thread 0x00003064 (most recent call first):
 
Three is a python27 folder under osgeo4w created after installation not sure that is supposed to be there
 
Any ideas how to solve ?
 
Cheers
Karsten
 
 
 

  _____  

From: Nicolas Cadieux [mailto:njacadieux.gitlab at gmail.com] 
Sent: Thursday, February 25, 2021 17:22
To: karsten
Cc: QGIS User
Subject: Re: [Qgis-user] osgeo4w shell gdal_calc not running


Hi, 

It’s odd that the OSGeo4w shell would ask for a version of Python (2.7) that has not been used since QGIS 2.x.  My guess is that the shell is picking up old configurations.  I would personally uninstall the entire OSGEO4W installation, delete the directories and the user files found in your user profile.   It’s a bit drastic as a solution but that would be my first solution... it would probably take less time than troubleshooting the shell...


Nicolas Cadieux 
https://gitlab.com/njacadieux


Le 25 févr. 2021 à 18:26, karsten <karsten at terragis.net> a écrit :



 
Hi All,
 
on my updated windows 10 I am trying to run gdal_calc via the osego4w shell (newest version).
I can see gdal_calc when running 0-help. When I try to run it: gdal_calc 
 
I am getting the following error:
 
Unable to create process using 'C:\OSGEO4~1\bin\python.exe "C:\OSGeo4W64\apps\Python27\Scripts\gdal_calc.py" '
 
I checked the system path and python 27 is not on the path itself but I have added c:\OSGeo4W64\bin\ . Seems it finds the old python only and that does not appear to run.
Any ideas how to solve this ?
 
Cheers
Karsten
 
_______________________________________________
Qgis-user mailing list
Qgis-user at lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20210225/8573895c/attachment.html>


More information about the Qgis-user mailing list