<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=utf-8" http-equiv=content-type>
<META name=GENERATOR content="MSHTML 11.00.10570.1001"></HEAD>
<BODY>
<DIV dir=ltr align=left><FONT color=#000080 size=2 face=Arial><SPAN
class=370173505-26022021>Hi All,</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT color=#000080 size=2 face=Arial><SPAN
class=370173505-26022021></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT color=#000080 size=2 face=Arial><SPAN
class=370173505-26022021>I was able to fix this by adding to both PATH and
PYTHONPATH environment variables the dir c:\OSGeo4W64\bin .
</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT color=#000080 size=2 face=Arial><SPAN
class=370173505-26022021>It now works if I specify the full path to the python
file as</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT color=#000080 size=2 face=Arial><SPAN
class=370173505-26022021></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT color=#000080 size=2 face=Arial><SPAN
class=370173505-26022021>python
c:\OSGeo4W64\bin\gdal_calc.py</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT color=#000080 size=2 face=Arial><SPAN
class=370173505-26022021></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT color=#000080 size=2 face=Arial><SPAN
class=370173505-26022021>but not when calling it as gdal_calc (gives and error
that the file is not found)</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT color=#000080 size=2 face=Arial><SPAN
class=370173505-26022021>even though that directory is on the PATH and
PYTHONPATH as well... </SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT color=#000080 size=2 face=Arial><SPAN
class=370173505-26022021>At least I can run it this way again
now</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT color=#000080 size=2 face=Arial><SPAN
class=370173505-26022021></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT color=#000080 size=2 face=Arial><SPAN
class=370173505-26022021>Cheers</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT color=#000080 size=2 face=Arial><SPAN
class=370173505-26022021>Karsten</SPAN></FONT></DIV><BR>
<DIV lang=en-us class=OutlookMessageHeader dir=ltr align=left>
<HR tabIndex=-1>
<FONT size=2 face=Tahoma><B>From:</B> karsten [mailto:karsten@terragis.net]
<BR><B>Sent:</B> Thursday, February 25, 2021 19:36<BR><B>To:</B> 'Nicolas
Cadieux'<BR><B>Cc:</B> 'QGIS User'<BR><B>Subject:</B> RE: [Qgis-user] osgeo4w
shell gdal_calc not running<BR></FONT><BR></DIV>
<DIV></DIV>
<DIV dir=ltr align=left><SPAN class=179522803-26022021><FONT color=#000080
size=2 face=Arial>Hi Nicolas,</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=179522803-26022021><FONT color=#000080
size=2 face=Arial></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=179522803-26022021><FONT color=#000080
size=2 face=Arial>thanks. I tried that route and removed all user folder
references to osgeo4w and qgis, then deinstalled and removed osgeo4w completely
, and reinstalled osgeo4w.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=179522803-26022021><FONT color=#000080
size=2 face=Arial></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=179522803-26022021><FONT color=#000080
size=2 face=Arial>I still have a problem (and also on a second machine on
windows 10 the same)</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=179522803-26022021><FONT color=#000080
size=2 face=Arial>though it is now a different error
message:</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=179522803-26022021><FONT color=#000080
size=2 face=Arial></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=179522803-26022021>Fatal Python error:
initfsencoding: unable to load the file system codec<BR> File
"C:\OSGEO4~1\apps\Python27\lib\encodings\__init__.py", line
123<BR> raise
CodecRegistryError,\<BR>
^<BR>SyntaxError: invalid syntax<BR>Current thread 0x00003064 (most recent call
first):</SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=179522803-26022021></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=179522803-26022021><FONT color=#000080
size=2 face=Arial>Three is a python27 folder under osgeo4w created after
installation not sure that is supposed to be there</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=179522803-26022021><FONT color=#000080
size=2 face=Arial></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=179522803-26022021><FONT color=#000080
size=2 face=Arial>Any ideas how to solve ?</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=179522803-26022021><FONT color=#000080
size=2 face=Arial></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=179522803-26022021><FONT color=#000080
size=2 face=Arial>Cheers</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=179522803-26022021><FONT color=#000080
size=2 face=Arial>Karsten</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=179522803-26022021><FONT color=#000080
size=2 face=Arial></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=179522803-26022021><FONT color=#000080
size=2 face=Arial></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=179522803-26022021><FONT color=#000080
size=2 face=Arial></FONT></SPAN> </DIV><BR>
<DIV lang=en-us class=OutlookMessageHeader dir=ltr align=left>
<HR tabIndex=-1>
<FONT size=2 face=Tahoma><B>From:</B> Nicolas Cadieux
[mailto:njacadieux.gitlab@gmail.com] <BR><B>Sent:</B> Thursday, February 25,
2021 17:22<BR><B>To:</B> karsten<BR><B>Cc:</B> QGIS User<BR><B>Subject:</B> Re:
[Qgis-user] osgeo4w shell gdal_calc not running<BR></FONT><BR></DIV>
<DIV></DIV>Hi,
<DIV><BR>
<DIV>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...<BR><BR>
<DIV dir=ltr>Nicolas Cadieux
<DIV><A
href="https://gitlab.com/njacadieux">https://gitlab.com/njacadieux</A></DIV></DIV>
<DIV dir=ltr><BR>
<BLOCKQUOTE type="cite">Le 25 févr. 2021 à 18:26, karsten
<karsten@terragis.net> a écrit :<BR><BR></BLOCKQUOTE></DIV>
<BLOCKQUOTE type="cite">
<DIV dir=ltr>
<META name=GENERATOR content="MSHTML 11.00.10570.1001">
<DIV dir=ltr align=left>
<DIV dir=ltr align=left>
<DIV><FONT color=#000080 size=2 face=Arial><SPAN class=523595208-25022021>Hi
All,</SPAN></FONT></DIV>
<DIV><FONT color=#000080 size=2 face=Arial><SPAN
class=523595208-25022021></SPAN></FONT> </DIV>
<DIV><SPAN class=523595208-25022021><SPAN class=629592622-25022021><FONT
face=Arial><FONT color=#000080><FONT size=2><SPAN class=178591823-25022021>on
my updated windows 10 I am trying to run gdal_calc via the osego4w shell
(newest version).</SPAN></FONT></FONT></FONT></SPAN></SPAN></DIV>
<DIV><SPAN class=523595208-25022021><SPAN class=629592622-25022021><SPAN
class=178591823-25022021></SPAN><FONT face=Arial><FONT color=#000080><FONT
size=2><SPAN class=178591823-25022021>I can see gdal_calc when running 0-help.
When I try to run it: </SPAN></FONT></FONT></FONT></SPAN></SPAN><SPAN
class=523595208-25022021><SPAN class=629592622-25022021><FONT face=Arial><FONT
color=#000080><FONT size=2><SPAN class=178591823-25022021>gdal_calc
</SPAN></FONT></FONT></FONT></SPAN></SPAN></DIV>
<DIV><SPAN class=523595208-25022021><SPAN class=629592622-25022021><FONT
face=Arial><FONT color=#000080><FONT size=2><SPAN
class=178591823-25022021></SPAN></FONT></FONT></FONT></SPAN></SPAN> </DIV>
<DIV><SPAN class=523595208-25022021><SPAN class=629592622-25022021><FONT
face=Arial><FONT color=#000080><FONT size=2><SPAN class=178591823-25022021>I
am getting the following
error:</SPAN></FONT></FONT></FONT></SPAN></SPAN></DIV>
<DIV><SPAN class=523595208-25022021><SPAN class=629592622-25022021><FONT
face=Arial><FONT color=#000080><FONT size=2><SPAN
class=178591823-25022021></SPAN></FONT></FONT></FONT></SPAN></SPAN> </DIV></DIV></DIV>
<DIV dir=ltr align=left><FONT color=#000080 size=2 face=Arial>Unable to create
process using 'C:\OSGEO4~1\bin\python.exe
"C:\OSGeo4W64\apps\Python27\Scripts\gdal_calc.py" '</FONT></DIV>
<DIV dir=ltr align=left><SPAN class=178591823-25022021><FONT color=#000080
size=2 face=Arial></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=178591823-25022021><FONT color=#000080
size=2 face=Arial>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.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=178591823-25022021><FONT color=#000080
size=2 face=Arial>Any ideas how to solve this ?</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=178591823-25022021><FONT color=#000080
size=2 face=Arial></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=178591823-25022021><FONT color=#000080
size=2 face=Arial>Cheers</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=178591823-25022021><FONT color=#000080
size=2 face=Arial>Karsten</FONT></SPAN></DIV>
<DIV><FONT color=#000080 size=2
face=Arial></FONT> </DIV><SPAN>_______________________________________________</SPAN><BR><SPAN>Qgis-user
mailing list</SPAN><BR><SPAN>Qgis-user@lists.osgeo.org</SPAN><BR><SPAN>List
info:
https://lists.osgeo.org/mailman/listinfo/qgis-user</SPAN><BR><SPAN>Unsubscribe:
https://lists.osgeo.org/mailman/listinfo/qgis-user</SPAN><BR></DIV></BLOCKQUOTE></DIV></DIV></BODY></HTML>