diff --git a/src/Mod/Fem/femtaskpanels/task_mesh_gmsh.py b/src/Mod/Fem/femtaskpanels/task_mesh_gmsh.py
index a82edcdeb9..30aac36737 100644
--- a/src/Mod/Fem/femtaskpanels/task_mesh_gmsh.py
+++ b/src/Mod/Fem/femtaskpanels/task_mesh_gmsh.py
@@ -153,8 +153,6 @@ class _TaskPanel:
self.form.cb_order.setCurrentIndex(index_order)
def console_log(self, message="", color="#000000"):
- if (not isinstance(message, bytes)) and (sys.version_info.major < 3):
- message = message.encode("utf-8", "replace")
self.console_message_gmsh = self.console_message_gmsh + (
'{0:4.1f}: {2}
'
.format(time.time() - self.Start, color, message)
diff --git a/src/Mod/Fem/femtaskpanels/task_solver_ccxtools.py b/src/Mod/Fem/femtaskpanels/task_solver_ccxtools.py
index 87adc6e139..8b06e8bd0f 100644
--- a/src/Mod/Fem/femtaskpanels/task_solver_ccxtools.py
+++ b/src/Mod/Fem/femtaskpanels/task_solver_ccxtools.py
@@ -173,8 +173,6 @@ class _TaskPanel:
return
def femConsoleMessage(self, message="", color="#000000"):
- if sys.version_info.major < 3:
- message = message.encode("utf-8", "replace")
self.fem_console_message = self.fem_console_message + (
'{0:4.1f}: {2}
'
.format(time.time() - self.Start, color, message)
diff --git a/src/Mod/Fem/femtest/app/test_common.py b/src/Mod/Fem/femtest/app/test_common.py
index 0a10b4d097..14b0a8969d 100644
--- a/src/Mod/Fem/femtest/app/test_common.py
+++ b/src/Mod/Fem/femtest/app/test_common.py
@@ -124,13 +124,6 @@ class TestFemCommon(unittest.TestCase):
# import all collected modules
# fcc_print(pymodules)
for mod in pymodules:
- # migrate modules do not import on Python 2
- if (
- mod == "femtools.migrate_app"
- or mod == "femguiutils.migrate_gui"
- ) and sys.version_info.major < 3:
- continue
-
if (
mod == "femsolver.solver_taskpanel"
or mod == "femexamples.examplesgui"
diff --git a/src/Mod/Fem/femtest/app/test_open.py b/src/Mod/Fem/femtest/app/test_open.py
index 50a8de63f4..b3c9e31959 100644
--- a/src/Mod/Fem/femtest/app/test_open.py
+++ b/src/Mod/Fem/femtest/app/test_open.py
@@ -129,10 +129,6 @@ class TestObjectOpen(unittest.TestCase):
def test_femobjects_open_de9b3fb438(
self
):
- # migration modules do not import on Python 2 thus this can not work
- if sys.version_info.major < 3:
- return
-
# the number in method name is the FreeCAD commit the document was created with
# https://github.com/FreeCAD/FreeCAD/commit/de9b3fb438
# the document was created by running the object create unit test
diff --git a/src/Mod/Fem/femtest/app/test_solver_elmer.py b/src/Mod/Fem/femtest/app/test_solver_elmer.py
index 0bdc14e9eb..43a77225af 100644
--- a/src/Mod/Fem/femtest/app/test_solver_elmer.py
+++ b/src/Mod/Fem/femtest/app/test_solver_elmer.py
@@ -175,13 +175,6 @@ class TestSolverElmer(unittest.TestCase):
def test_ccxcantilever_faceload_1_si(
self
):
- if sys.version_info.major < 3:
- # TODO does not pass on Python 2
- # https://travis-ci.org/github/FreeCAD/FreeCAD/builds/707885742
- # https://api.travis-ci.org/v3/job/707885745/log.txt
- fcc_print("Python 2: test aborted.")
- return
-
fcc_print("")
self.set_unit_schema(1) # SI-units m/kg/s
from femexamples.ccx_cantilever_faceload import setup
diff --git a/src/Mod/Fem/femtest/app/test_solver_z88.py b/src/Mod/Fem/femtest/app/test_solver_z88.py
index 275024e689..8cedbb1749 100644
--- a/src/Mod/Fem/femtest/app/test_solver_z88.py
+++ b/src/Mod/Fem/femtest/app/test_solver_z88.py
@@ -115,13 +115,6 @@ class TestSolverZ88(unittest.TestCase):
self,
base_name
):
- if sys.version_info.major < 3:
- # TODO does not pass on Python 2
- # https://travis-ci.org/github/FreeCAD/FreeCAD/builds/707780320
- # https://api.travis-ci.org/v3/job/707780323/log.txt
- fcc_print("Python 2: test aborted.")
- return
-
self.document.recompute()
# start
diff --git a/src/Mod/Fem/femtest/gui/test_open.py b/src/Mod/Fem/femtest/gui/test_open.py
index 454a836ce7..d7fd521a3b 100644
--- a/src/Mod/Fem/femtest/gui/test_open.py
+++ b/src/Mod/Fem/femtest/gui/test_open.py
@@ -126,10 +126,6 @@ class TestObjectOpen(unittest.TestCase):
def test_femobjects_open_de9b3fb438(
self
):
- # migration modules do not import on Python 2 thus this can not work
- if sys.version_info.major < 3:
- return
-
# the number in method name is the FreeCAD commit the document was created with
# https://github.com/FreeCAD/FreeCAD/commit/de9b3fb438
# the document was created by running the object create unit test
diff --git a/src/Mod/Fem/femtools/femutils.py b/src/Mod/Fem/femtools/femutils.py
index f4a00c58cf..ed376a58e4 100644
--- a/src/Mod/Fem/femtools/femutils.py
+++ b/src/Mod/Fem/femtools/femutils.py
@@ -378,16 +378,8 @@ def get_refshape_type(fem_doc_object):
def pydecode(bytestring):
- """ Return *bytestring* as a unicode string for python 2 and 3.
-
- For python 2 *bytestring* is converted to a string of type ``unicode``. For
- python 3 it is returned as is because it uses unicode for it's ``str`` type
- already.
- """
- if sys.version_info.major < 3:
- return bytestring
- else:
- return bytestring.decode("utf-8")
+ """ Return *bytestring* as a unicode string """
+ return bytestring.decode("utf-8")
def startProgramInfo(code):
diff --git a/src/Mod/Material/MaterialEditor.py b/src/Mod/Material/MaterialEditor.py
index c546ab199c..54fa09c1cc 100644
--- a/src/Mod/Material/MaterialEditor.py
+++ b/src/Mod/Material/MaterialEditor.py
@@ -543,9 +543,6 @@ class MaterialEditor:
group = item.parent()
it = group.child(item.row(), 1)
name = it.text()
- if sys.version_info.major < 3:
- if isinstance(name, unicode):
- name = name.encode("utf8")
if not name:
name = "Material"
filetuple = QtGui.QFileDialog.getSaveFileName(