Skip to content

Converting python examples so they also run on Py3k.

There are 155 python examples in 21 folders.

I have run each example using Python 3.4 and making changes where applicable.

For those I couldn't run (see below) I also ran 2to3 on them and modified any print statements etc.

Changes:

  • Mainly print x -> print(x)
  • For examples using Tk, these are now use tkinter instead of Tkinter if Py3k is used.
  • The abstract class vtkCompositeDataIterator in SingleYoungsMaterialInterface.py was replaced with vtkDataObjectTreeIterator.

Not tested:

GUI/Qt/GraphicsViewPython/

No PyQt4
  • GraphicsViewPython.py

Examples\Infovis\Python\

No boost:
  • boost*.py
  • graph_tree_ring.py
  • hierarchical_graph.py
  • selection.py
  • simple_selection.py
  • tree1.py

No database access (it belongs to Sandia):

  • mysql_database.py

No Matlab:

  • Matlab_engine_filter.py
  • Matlab_engine_interface.py

No PyQt4

  • gui.py
  • streaming_statistics_pyqt.py

No R

  • Rcalculator_mst.py
  • Rcalculator_vd.py
  • Rinterface.py
  • Rrand_table.py

Fails

Maybe because I am running OpenGL2 or I don't have the requisite option set:

 Examples/Infovis/Python>python databases2.py
Traceback (most recent call last):
  File "databases2.py", line 15, in <module>
    databaseToGraph = vtkSQLDatabaseGraphSource()
NameError: name 'vtkSQLDatabaseGraphSource' is not defined

 Examples\ParallelProcessing\MPI\Python>python ParallelCone.py
Traceback (most recent call last):
  File "ParallelCone.py", line 10, in <module>
    compManager = vtkCompositeRenderManager()
NameError: name 'vtkCompositeRenderManager' is not defined

These work with the OpenGL backend, tested by @dgobbi:
 SimpleTextureMap2D.py
 VolumePicker.py

Merge request reports