diff --git a/pytorch3d/io/off_io.py b/pytorch3d/io/off_io.py index 78b4390d..42181610 100644 --- a/pytorch3d/io/off_io.py +++ b/pytorch3d/io/off_io.py @@ -84,7 +84,7 @@ def _read_faces_lump( ) data = np.loadtxt(file, dtype=np.float32, ndmin=2, max_rows=n_faces) except ValueError as e: - if n_faces > 1 and "Wrong number of columns" in e.args[0]: + if n_faces > 1 and "number of columns" in e.args[0]: file.seek(old_offset) return None raise ValueError("Not enough face data.") from None diff --git a/tests/test_io_off.py b/tests/test_io_off.py index 6a5dc669..c92f65de 100644 --- a/tests/test_io_off.py +++ b/tests/test_io_off.py @@ -286,15 +286,15 @@ class TestMeshOffIO(TestCaseMixin, unittest.TestCase): lines2 = lines.copy() lines2[0] = "6 2 0" - with self.assertRaisesRegex(ValueError, "Wrong number of columns at line 5"): + with self.assertRaisesRegex(ValueError, "number of columns"): load(lines2) lines2[0] = "5 1 0" - with self.assertRaisesRegex(ValueError, "Wrong number of columns at line 5"): + with self.assertRaisesRegex(ValueError, "number of columns"): load(lines2) lines2[0] = "16 2 0" - with self.assertRaisesRegex(ValueError, "Wrong number of columns at line 5"): + with self.assertRaisesRegex(ValueError, "number of columns"): load(lines2) lines2[0] = "3 3 0" @@ -312,7 +312,7 @@ class TestMeshOffIO(TestCaseMixin, unittest.TestCase): lines2 = lines.copy() lines2[2] = "7.3 4.2 8.3 932" - with self.assertRaisesRegex(ValueError, "Wrong number of columns at line 2"): + with self.assertRaisesRegex(ValueError, "number of columns"): load(lines2) lines2[1] = "7.3 4.2 8.3 932"