Uploaded image for project: 'Beam'
  1. Beam
  2. BEAM-7876

Interactive Beam example does not work with Python3

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.15.0
    • Component/s: examples-python
    • Labels:
      None

      Description

      When going through the example  https://github.com/apache/beam/blob/master/sdks/python/apache_beam/runners/interactive/README.md using Jupyter Notebook running in Python 3, the run() method throws an error the following error:

      TypeError Traceback (most recent call last)
      <ipython-input-3-6b6671c6b2d0> in <module>
      {{ 3 squares = init_pcoll | 'Square' >> beam.Map(lambda x: x*x)}}
      {{ 4 cubes = init_pcoll | 'Cube' >> beam.Map(lambda x: x**3)}}
      ----> 5 result = p.run()
      {{ 6 result.wait_until_finish()}}~/beam/sdks/python/apache_beam/pipeline.py in run(self, test_runner_api)
      {{ 404 self.to_runner_api(use_fake_coders=True),}}
      {{ 405 self.runner,}}
      --> 406 self._options).run(False)
      {{ 407 }}
      {{ 408 if self._options.view_as(TypeOptions).runtime_type_check:}}~/beam/sdks/python/apache_beam/pipeline.py in run(self, test_runner_api)
      {{ 417 finally:}}
      {{ 418 shutil.rmtree(tmpdir)}}
      --> 419 return self.runner.run_pipeline(self, self._options)
      {{ 420 }}
      {{ 421 def _enter_(self):}}~/beam/sdks/python/apache_beam/runners/interactive/interactive_runner.py in run_pipeline(self, pipeline, options)
      {{ 142 cache_manager=self._cache_manager,}}
      {{ 143 pipeline_graph_renderer=self._renderer)}}
      --> 144 display.start_periodic_update()
      {{ 145 result = pipeline_to_execute.run()}}
      {{ 146 result.wait_until_finish()}}~/beam/sdks/python/apache_beam/runners/interactive/display/display_manager.py in start_periodic_update(self)
      {{ 158 def start_periodic_update(self):}}
      {{ 159 """Start a thread that periodically updates the display."""}}
      --> 160 self.update_display(True)
      {{ 161 self._periodic_update = True}}
      {{ 162}}~/beam/sdks/python/apache_beam/runners/interactive/display/display_manager.py in update_display(self, force)
      {{ 149 rendered_graph = self._renderer.render_pipeline_graph(}}
      {{ 150 self._pipeline_graph)}}
      --> 151 display.display(display.HTML(rendered_graph))
      {{ 152 }}
      {{ 153 display_progress('Running...')}}~/beam/sdks/python/notebook3/lib/python3.6/site-packages/IPython/core/display.py in __init_(self, data, url, filename, metadata)
      {{ 691 return prefix.startswith("<iframe ") and suffix.endswith("</iframe>")}}
      {{ 692 }}
      --> 693 if warn():
      {{ 694 warnings.warn("Consider using IPython.display.IFrame instead")}}
      {{ 695 super(HTML, self)._init_(data=data, url=url, filename=filename, metadata=metadata)}}~/beam/sdks/python/notebook3/lib/python3.6/site-packages/IPython/core/display.py in warn()
      {{ 689 prefix = data[:10].lower()}}
      {{ 690 suffix = data[-10:].lower()}}
      --> 691 return prefix.startswith("<iframe ") and suffix.endswith("</iframe>")
      {{ 692 }}
      {{ 693 if warn():}}TypeError: startswith first arg must be bytes or a tuple of bytes, not str

       

       

       

      This does not happen with Python 2.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                davidyan David Yan
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 0.5h
                  0.5h