[GRASS-dev] [GRASS GIS] #3753: g.gui.tplot and g.gui.timeline: AttributeError: 'itertools.cycle' object has no attribute 'next'

#3753: g.gui.tplot and g.gui.timeline: AttributeError: 'itertools.cycle' object
has no attribute 'next'
-------------------------------+-------------------------
Reporter: veroandreo | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 7.8.0
Component: wxGUI | Version: svn-trunk
Keywords: temporal, python3 | CPU: Unspecified
Platform: Linux |
-------------------------------+-------------------------
I encountered this error when running G7:g.gui.tplot and G7:g.gui.timeline
under python 3 in a viartualenv:

{{{
g.gui.tplot strds=A coordinates=634816.901408,225066.901408
20:15:54: Debug: Adding duplicate image handler for 'Windows bitmap file'
Traceback (most recent call last):
   File "/home/veroandreo/software/grass7_trunk/dist.x86_64-pc-linux-
gnu/scripts/g.gui.tplot", line 175, in <module>
     main()
   File "/home/veroandreo/software/grass7_trunk/dist.x86_64-pc-linux-
gnu/scripts/g.gui.tplot", line 162, in main
     ylabel, csvfile, flags['h'], gscript .overwrite)
   File "/home/veroandreo/software/grass7_trunk/dist.x86_64-pc-linux-
gnu/gui/wxpython/tplot/frame.py", line 1020, in SetDatasets
     self._redraw()
   File "/home/veroandreo/software/grass7_trunk/dist.x86_64-pc-linux-
gnu/gui/wxpython/tplot/frame.py", line 900, in _redraw
     self._drawFigure()
   File "/home/veroandreo/software/grass7_trunk/dist.x86_64-pc-linux-
gnu/gui/wxpython/tplot/frame.py", line 623, in _drawFigure
     self.drawR()
   File "/home/veroandreo/software/grass7_trunk/dist.x86_64-pc-linux-
gnu/gui/wxpython/tplot/frame.py", line 689, in drawR
     color = self.colors.next()
AttributeError: 'itertools.cycle' object has no attribute 'next'
WARNING:root:Needed to restart the libgis server, caller: Server check
thread
}}}

and

{{{
g.gui.timeline inputs=A
Traceback (most recent call last):
   File "/home/veroandreo/software/grass7_trunk/dist.x86_64-pc-linux-
gnu/scripts/g.gui.timeline", line 68, in <module>
     main()
   File "/home/veroandreo/software/grass7_trunk/dist.x86_64-pc-linux-
gnu/scripts/g.gui.timeline", line 61, in main
     frame.SetDatasets(datasets)
   File "/home/veroandreo/software/grass7_trunk/dist.x86_64-pc-linux-
gnu/gui/wxpython/timeline/frame.py", line 519, in SetDatasets
     self._redraw()
   File "/home/veroandreo/software/grass7_trunk/dist.x86_64-pc-linux-
gnu/gui/wxpython/timeline/frame.py", line 418, in _redraw
     self._draw2dFigure()
   File "/home/veroandreo/software/grass7_trunk/dist.x86_64-pc-linux-
gnu/gui/wxpython/timeline/frame.py", line 351, in _draw2dFigure
     color = colors.next()
AttributeError: 'itertools.cycle' object has no attribute 'next'
WARNING:root:Needed to restart the libgis server, caller: Server check
thread
}}}

To reproduce in NC location:

{{{
g.region raster=elevation
for map in `seq 1 10` ; do r.mapcalc "prueba_${map} = ${map}" ; done
t.create output=A type=strds temporaltype=absolute title="test"
description="test"
t.register input=A maps=`g.list rast pat=prueba* sep=, map=.`
start="2000-01-01" increment="1 months" -i
g.gui.timeline inputs=A
g.gui.tplot strds=A coordinates=634816.901408,225066.901408
}}}

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3753&gt;
GRASS GIS <https://grass.osgeo.org>

#3753: g.gui.tplot and g.gui.timeline: AttributeError: 'itertools.cycle' object
has no attribute 'next'
--------------------------+-------------------------------
  Reporter: veroandreo | Owner: grass-dev@…
      Type: defect | Status: closed
  Priority: normal | Milestone: 7.8.0
Component: wxGUI | Version: svn-trunk
Resolution: fixed | Keywords: temporal, python3
       CPU: Unspecified | Platform: Linux
--------------------------+-------------------------------
Changes (by annakrat):

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

Comment:

In [changeset:"74095" 74095]:
{{{
#!CommitTicketReference repository="" revision="74095"
wxGUI/timeline: fix #3753
}}}

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3753#comment:1&gt;
GRASS GIS <https://grass.osgeo.org>

#3753: g.gui.tplot and g.gui.timeline: AttributeError: 'itertools.cycle' object
has no attribute 'next'
--------------------------+-------------------------------
  Reporter: veroandreo | Owner: grass-dev@…
      Type: defect | Status: reopened
  Priority: normal | Milestone: 7.8.0
Component: wxGUI | Version: svn-trunk
Resolution: | Keywords: temporal, python3
       CPU: Unspecified | Platform: Linux
--------------------------+-------------------------------
Changes (by neteler):

* status: closed => reopened
* resolution: fixed =>

Comment:

There are a some more occurrences in the code, should they be fixed in the
same way?

{{{
ag --python "\.next\(\)"
scripts/d.rast.edit/d.rast.edit.py
343: it.Next()

temporal/t.rast.accdetect/t.rast.accdetect.py
369: prev_map =
occurrence_maps[map.next().get_id()].get_name()
382: prev_map =
occurrence_maps[map.next().get_id()].get_name()
392: next_map =
occurrence_maps[map.next().get_id()].get_name()

gui/wxpython/tplot/frame.py
689: color = self.colors.next()
736: color = self.colors.next()
781: color = self.colors.next()

lib/python/temporal/temporal_topology_dataset_connector.py
58: start = start.next()
509: if self.next() is not None:
510: print(" | Next: ...................... " +
str(self.next().get_id()))
550: if self.next() is not None:
551: print("next=" + self.next().get_id())

lib/python/temporal/spatio_temporal_relationships.py
74: first = first.next()
442: next_ = map_.next()
581: start_ = start_.next()

lib/python/pygrass/vector/__init__.py
96: >>> test_vect.next()
98: >>> test_vect.next()
457: >>> test_vect.next()
459: >>> test_vect.next()
461: >>> test_vect.next()
464: >>> test_vect.next()
}}}

and

{{{
ag --python "zip\("
scripts/g.extension/g.extension.py
1062:def extract_zip(name, directory, tmpdir):
1064: gscript.debug("extract_zip(name={name}, directory={directory},"
1120: extract_zip(name=zip_name, directory=directory,
tmpdir=tmpdir)
1131: extract_zip(name=url, directory=directory, tmpdir=tmpdir)

scripts/i.oif/i.oif.py
135: for i, row in zip(bands, lines[1:]):
136: for j, cell in zip(bands, row.split(' ')):

scripts/v.report/v.report.py
208: records3 = [[r1] + [r4] for r1, r4 in zip(records1,
records4)]
210: records3 = [r1 + [r4] for r1, r4 in zip(records1,
records4)]

scripts/i.image.mosaic/i.image.mosaic.py
93: for img, offset in zip(images, offsets):

temporal/t.rast3d.univar/testsuite/test_univar.py
57: for ref, res in zip(univar_text.split("\n"),
t_rast3d_univar.outputs.stdout.split("\n")):
75: for ref, res in zip(univar_text.split("\n"),
t_rast3d_univar.outputs.stdout.split("\n")):
95: for ref, res in zip(univar_text.split("\n"),
univar_output.split("\n")):
114: for ref, res in zip(univar_text.split("\n"),
univar_output.split("\n")):

temporal/t.vect.observe.strds/t.vect.observe.strds.py
233: for name, column in zip(raster_names, column_names):
270: for name, column in zip(raster_names, column_names):

temporal/t.connect/testsuite/test_distr_tgis_db_raster.py
82: for a, b in zip(list_string.split("\n"), out.split("\n")):
93: for a, b in zip(list_string.split("\n"),
read_data.split("\n")):
112: for a, b in zip(list_string.split("\n"), out.split("\n")):
125: for a, b in zip(list_string.split("\n"), out.split("\n")):
138: for a, b in zip(list_string.split("\n"), out.split("\n")):
151: for a, b in zip(list_string.split("\n"), out.split("\n")):
164: for a, b in zip(list_string.split("\n"), out.split("\n")):
173: for a, b in zip(list_string.split("\n"),
read_data.split("\n")):

temporal/t.connect/testsuite/test_distr_tgis_db_raster3d.py
82: for a, b in zip(list_string.split("\n"), out.split("\n")):
93: for a, b in zip(list_string.split("\n"),
read_data.split("\n")):
112: for a, b in zip(list_string.split("\n"), out.split("\n")):
125: for a, b in zip(list_string.split("\n"), out.split("\n")):
138: for a, b in zip(list_string.split("\n"), out.split("\n")):
151: for a, b in zip(list_string.split("\n"), out.split("\n")):
160: for a, b in zip(list_string.split("\n"),
read_data.split("\n")):

temporal/t.connect/testsuite/test_distr_tgis_db_vector.py
81: for a, b in zip(list_string.split("\n"), out.split("\n")):
92: for a, b in zip(list_string.split("\n"),
read_data.split("\n")):
113: for a, b in zip(list_string.split("\n"), out.split("\n")):
128: for a, b in zip(list_string.split("\n"), out.split("\n")):
143: for a, b in zip(list_string.split("\n"), out.split("\n")):
158: for a, b in zip(list_string.split("\n"), out.split("\n")):
168: for a, b in zip(list_string.split("\n"),
read_data.split("\n")):

temporal/t.rast.univar/testsuite/test_univar.py
57: for ref, res in zip(univar_text.split("\n"),
t_rast_univar.outputs.stdout.split("\n")):
76: for ref, res in zip(univar_text.split("\n"),
t_rast_univar.outputs.stdout.split("\n")):
95: for ref, res in zip(univar_text.split("\n"),
t_rast_univar.outputs.stdout.split("\n")):
116: for ref, res in zip(univar_text.split("\n"),
univar_output.split("\n")):
136: for ref, res in zip(univar_text.split("\n"),
univar_output.split("\n")):

raster3d/r3.to.rast/testsuite/test_a_b_coeff.py
153: for rast_ref, rast in zip(self.rast2d_refs, rasts):

raster3d/r3.to.rast/testsuite/test_small_data.py
153: for rast_ref, rast in zip(self.rast2d_refs, rasts):

raster3d/r3.to.rast/testsuite/test_integer_rounding.py
153: for rast_ref, rast in zip(self.rast2d_refs, rasts):

raster3d/r3.to.rast/testsuite/test_nulls.py
159: for rast_ref, rast in zip(self.rast2d_refs, rasts):

gui/wxpython/iclass/toolbars.py
223: for name, idx in zip(catNames, catIdx):

gui/wxpython/iscatt/plots.py
114: pol = Polygon(list(zip([0], [0])), animated=True)
120: self.zoom_rect = Polygon(list(zip([0], [0])),
facecolor='none')
652: x, y = zip(*self.pol.xy)
839: self.line.set_data(zip(*self.pol.xy))
859: self.line.set_data(zip(*self.pol.xy))
877: self.line.set_data(zip(*self.pol.xy))
906: self.line.set_data(zip(*self.pol.xy))

gui/wxpython/iscatt/controllers.py
150: self.all_bands_to_bands = dict(zip(bands, [-1] * len(bands)))

gui/wxpython/startup/locdownload.py
130:def extract_zip(name, directory, tmpdir):
132: debug("extract_zip(name={name}, directory={directory},"
204: extract_zip(name=archive_name, directory=directory,
tmpdir=tmpdir)

gui/wxpython/nviz/mapwindow.py
1077: for key, val in zip(('x', 'y', 'z'),
self._display.GetViewdir()):

gui/wxpython/nviz/tools.py
3112: for win, name in zip((w, n, s, e, nw, ne, se, sw),
4827: for coord, val in zip(

gui/wxpython/gui_core/simplelmgr.py
148: for label, text in zip(labels, texts):

gui/wxpython/psmap/instructions.py
753: zip(['width', 'height', 'left', 'right', 'top', 'bottom'],
self.cats))
803: d = dict(zip(self.cats, line.split()[1:]))

gui/wxpython/mapswipe/toolbars.py
117: for label, cdata in zip(

gui/wxpython/psmap/dialogs.py
536: self.catsLabels = dict(zip(self.cat, labels))
723: d = dict(zip([self.cat[1]] + self.cat[3:], line.split()))
4336: for vmap, vector in zip(vmaps, vList):
4955: for item, path in zip(['fancy', 'simple'], imagePath):

gui/wxpython/animation/data.py
264: for value, region in zip(values, regions):

gui/wxpython/animation/nviztask.py
102: for attr, params in zip(attributes, parameters):
129: for mode1, mode2 in zip(
184: for attr, params in zip(attributes, parameters):

gui/wxpython/animation/temporal_manager.py
208: for mapList, labelList in zip(mapLists, labelLists):
445: for name, fname in zip((name1, name2), (n1, n2)):
520: for name, fname in zip((name1, name2), (n1, n2)):

gui/wxpython/animation/provider.py
121: for cmdList, region in zip(self._cmdsForComposition,
self._regions):
138: for cmd, region in zip(self._uniqueCmds,
142: for cmdList, region in zip(
162: for cmd, region in zip(uniqueCmds, regions):
185: for cmdList, region in zip(cmdLists, regions):
351: for cmd, region in zip(cmdList, regions):
469: for cmdList, region in zip(cmdLists, regions):

gui/wxpython/animation/dialogs.py
229: for item, cdata in zip(timeUnitsChoice, timeUnits):
994: for buttonName, buttonLabel in zip(buttonNames, buttonLabels):

gui/wxpython/animation/utils.py
344: return list(zip(*cmdsForComposition))

gui/wxpython/animation/controller.py
53: for anim, win in zip(self.animations, self.mapwindows):
362: region in zip(anim.cmdMatrix, regions)])
533: for i, (win, anim) in enumerate(zip(self.mapwindows,
self.animations)):

gui/wxpython/tplot/frame.py
653: zipped = zip(x, *y)
655: zipped = zip(x, y)
1189: ys = zip(*info[1].values())[1]

lib/python/gunittest/multirunner.py
141: for location, location_type in zip(locations, locations_types):

lib/python/gunittest/multireport.py
325: for image, caption in itertools.izip(images, captions):

lib/python/ctypes/ctypesgencore/parser/yacc.py
2024: for _x,_y in zip(_v[0],_v[1]):
2062: for _x,_y in zip(_v[0],_v[1]):

lib/python/ctypes/ctypesgencore/parser/parsetab.py
13: for _x,_y in zip(_v[0],_v[1]):
21: for _x,_y in zip(_v[0],_v[1]):

lib/python/pygrass/modules/interface/module.py
627: for param, arg in zip(self.params_list, args):

lib/python/pygrass/vector/table.py
433: for cn, ct in zip(col_name, col_type)]

lib/python/pygrass/vector/testsuite/test_vector3d.py
44: for x, y, z in zip(self.x, self.y, self.z):

lib/python/pygrass/vector/testsuite/test_table.py
69: return np.array([v for v in zip(*vals)], dtype=dtype)

lib/python/pygrass/vector/geometry.py
225: for key, val in zip(self.keys(), self.values()):

lib/python/pygrass/vector/testsuite/test_geometry.py
338: for boundary, i in zip(boundaries, range(4)):

lib/python/imaging/images2gif.py
429: for im, palette in zip(images, palettes):
}}}

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3753#comment:2&gt;
GRASS GIS <https://grass.osgeo.org>

#3753: g.gui.tplot and g.gui.timeline: AttributeError: 'itertools.cycle' object
has no attribute 'next'
--------------------------+-------------------------------
  Reporter: veroandreo | Owner: grass-dev@…
      Type: defect | Status: reopened
  Priority: normal | Milestone: 7.8.0
Component: wxGUI | Version: svn-trunk
Resolution: | Keywords: temporal, python3
       CPU: Unspecified | Platform: Linux
--------------------------+-------------------------------

Comment (by annakrat):

Most are ok, changes done in r74102, r74101.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3753#comment:3&gt;
GRASS GIS <https://grass.osgeo.org>

#3753: g.gui.tplot and g.gui.timeline: AttributeError: 'itertools.cycle' object
has no attribute 'next'
--------------------------+-------------------------------
  Reporter: veroandreo | Owner: grass-dev@…
      Type: defect | Status: closed
  Priority: normal | Milestone: 7.8.0
Component: wxGUI | Version: svn-trunk
Resolution: fixed | Keywords: temporal, python3
       CPU: Unspecified | Platform: Linux
--------------------------+-------------------------------
Changes (by annakrat):

* status: reopened => closed
* resolution: => fixed

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3753#comment:4&gt;
GRASS GIS <https://grass.osgeo.org>