[osgeo4w-dev] GDAL tools that are Python scripts still need Python2 in OSGeo4W

Pedro Venâncio pedrongvenancio at gmail.com
Thu Nov 21 01:13:34 PST 2019


Hi Jurgen,

Yes, without py3_env, python3 doesn't work at all:

C:\>python3 -m rgb2pct -n 2 -of GTiff D:\orto_teste.tif
D:\orto_teste_pct_2.tif

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 0x00003268 (most recent call first):

C:\>py3_env

C:\>SET PYTHONPATH=
C:\>SET PYTHONHOME=C:\OSGEO4~1\apps\Python37
C:\>PATH
C:\OSGEO4~1\apps\Python37;C:\OSGEO4~1\apps\Python37\Scripts;C:\OSGEO4~1\apps\Python27\Scripts;C:\OSGEO4~1\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\system32\WBem

C:\>python3 -m rgb2pct -n 2 -of GTiff D:\orto_teste.tif
D:\orto_teste_pct_2.tif
0...10...20...30...40...50...60...70...80...90...100 - done.

If I uninstall gdal-python:

C:\>python3 -m rgb2pct -n 2 -of GTiff D:\orto_teste.tif
D:\orto_teste_pct_3.tif
C:\OSGEO4~1\bin\python3.exe: No module named rgb2pct

And gdal-python has python2 as dependency.

So, it seems that OSGeo4W needs to mark gdal-python install by default. But
the python2 dependency is strange.

Thanks Jurgen.

Best regards,
Pedro



Jürgen E. Fischer <jef at norbit.de> escreveu no dia quinta, 21/11/2019 à(s)
01:39:

> Hi Pedro,
>
> On Wed, 20. Nov 2019 at 16:19:20 +0000, Pedro Venâncio wrote:
> > I've a clean OSGeo4W install and I was trying to use some GDAL tools like
> > gdal2xyz or rgb2pct, but I was getting an error of missing module in
> > Python3:
> >
> > python3 -m rgb2pct -n 2 -of GTiff D:\orto_teste.tif D:/orto_teste_pct.tif
> > GDAL command output:
> > C:\OSGEO4~1\bin\python3.exe: No module named rgb2pct
>
> Did you run call py3_env.bat upfront?
>
>
> Jürgen
>
> --
> Jürgen E. Fischer           norBIT GmbH             Tel. +49-4931-918175-31
> Dipl.-Inf. (FH)             Rheinstraße 13          Fax. +49-4931-918175-50
> Software Engineer           D-26506 Norden
> https://www.norbit.de
> _______________________________________________
> osgeo4w-dev mailing list
> osgeo4w-dev at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/osgeo4w-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/osgeo4w-dev/attachments/20191121/cc72a1d4/attachment.html>


More information about the osgeo4w-dev mailing list