[GRASS-dev] [GRASS GIS] #3837: OSGeo4W winGRASS77svn - startup error: TypeError: endswith first arg must be bytes or a tuple of bytes, not str
GRASS GIS
trac at osgeo.org
Sat May 11 02:31:48 PDT 2019
#3837: OSGeo4W winGRASS77svn - startup error: TypeError: endswith first arg must
be bytes or a tuple of bytes, not str
--------------------------+------------------------------------
Reporter: hellik | Owner: grass-dev@…
Type: defect | Status: new
Priority: blocker | Milestone: 7.8.0
Component: Python | Version: svn-trunk
Resolution: | Keywords: python3, py3, wingrass
CPU: Unspecified | Platform: MSWindows
--------------------------+------------------------------------
Comment (by hellik):
Replying to [comment:5 pmav99]:
> The traceback in the original post indicates that the problematic line
is:
> {{{
> if any(cmd.lower().endswith(ext.lower()) for ext in pathext):
> }}}
> which currently has been changed to (I guess with other changes, too):
> {{{
> if any(cmd.lower().endswith(ext) for ext in pathext):
> }}}
> Could you please paste an updated traceback?
https://trac.osgeo.org/grass/browser/grass/trunk/lib/python/script/core.py#L210
{{{
195 if sys.platform == "win32":
196 # The current directory takes precedence on Windows.
197 if not os.curdir in path:
198 path.insert(0, os.curdir)
199
200 # PATHEXT is necessary to check on Windows (force
lowercase)
201 pathext = list(map(lambda x: encode(x.lower()),
202 os.environ.get("PATHEXT",
"").split(os.pathsep)))
203 if b'.py' not in pathext:
204 # we assume that PATHEXT contains always '.py'
205 pathext.insert(0, b'.py')
206 # See if the given file matches any of the expected path
extensions.
207 # This will allow us to short circuit when given
"python.exe".
208 # If it does match, only test that one, otherwise we have
to try
209 # others.
210 if any(cmd.lower().endswith(ext) for ext in pathext):
211 files = [cmd]
212 else:
213 files = [cmd + ext for ext in pathext]
}}}
{{{
C:\>g.version -breg
version=7.7.svn
date=2019
revision=r74474M
build_date=2019-05-08
build_platform=x86_64-w64-mingw32
build_off_t_size=8
./configure --host=x86_64-w64-mingw32 '--with-
libs=/c/msys64/usr/src/grass_trunk/mswindows/osgeo4w/lib ' --with-
includes=/c/OSGeo4W64/include --libexecdir=/c/OSGeo4W64/bin
--prefix=/c/OSGeo4W64/apps/grass --bindir=/c/OSGeo4W64/bin
--includedir=/c/OSGeo4W64/include --without-x --with-cxx --enable-shared
--enable-largefile --with-fftw --with-freetype --with-proj-
share=/c/OSGeo4W64/share/proj --with-
gdal=/c/msys64/usr/src/grass_trunk/mswindows/osgeo4w/gdal-config --with-
geos=/c/msys64/usr/src/grass_trunk/mswindows/osgeo4w/geos-config --with-
sqlite --with-regex --with-nls --with-freetype-
includes=/c/OSGeo4W64/include/freetype2 --with-zstd --with-odbc --with-
cairo --with-postgres --with-opengl=windows --with-bzlib --with-
liblas=/c/msys64/usr/src/grass_trunk/mswindows/osgeo4w/liblas-config
libgis_revision=74118
libgis_date="2019-02-21 10:38:28 +0100 (Thu, 21 Feb 2019) "
proj4=5.2.0
gdal=2.4.1
geos=3.7.0
sqlite=3.26.0
}}}
with r74474
{{{
C:\>g.gui wxpython
Launching <wxpython> GUI in the background, please wait...
Traceback (most recent call last):
File "C:\OSGEO4~1\apps\grass\grass77/gui/wxpython/wxgui.py", line 32, in
<module>
from core import globalvar
File "C:\OSGEO4~1\apps\grass\grass77\gui\wxpython\core\globalvar.py",
line 35, in <module>
from core.debug import Debug
File "C:\OSGEO4~1\apps\grass\grass77\gui\wxpython\core\debug.py", line
77, in <module>
Debug = DebugMsg()
File "C:\OSGEO4~1\apps\grass\grass77\gui\wxpython\core\debug.py", line
39, in __init__
self.SetLevel()
File "C:\OSGEO4~1\apps\grass\grass77\gui\wxpython\core\debug.py", line
45, in SetLevel
self.debuglevel = int(grass.gisenv().get('WX_DEBUG', 0))
File "C:\OSGEO4~1\apps\grass\grass77\etc\python\grass\script\core.py",
line 1075, in gisenv
s = read_command("g.gisenv", flags='n', env=env)
File "C:\OSGEO4~1\apps\grass\grass77\etc\python\grass\script\core.py",
line 495, in read_command
process = pipe_command(*args, **kwargs)
File "C:\OSGEO4~1\apps\grass\grass77\etc\python\grass\script\core.py",
line 464, in pipe_command
return start_command(*args, **kwargs)
File "C:\OSGEO4~1\apps\grass\grass77\etc\python\grass\script\core.py",
line 394, in start_command
return Popen(args, **popts)
File "C:\OSGEO4~1\apps\grass\grass77\etc\python\grass\script\core.py",
line 54, in __init__
cmd = shutil_which(args[0])
File "C:\OSGEO4~1\apps\Python37\lib\shutil.py", line 1151, in which
if any(cmd.lower().endswith(ext.lower()) for ext in pathext):
File "C:\OSGEO4~1\apps\Python37\lib\shutil.py", line 1151, in <genexpr>
if any(cmd.lower().endswith(ext.lower()) for ext in pathext):
TypeError: endswith first arg must be bytes or a tuple of bytes, not str
}}}
--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3837#comment:6>
GRASS GIS <https://grass.osgeo.org>
More information about the grass-dev
mailing list