mirror of
https://github.com/facebookresearch/pytorch3d.git
synced 2025-07-31 10:52:50 +08:00
Fix OFF for new numpy errors
Summary: Error messages have changed around numpy version 2, making existing code fail. Reviewed By: MichaelRamamonjisoa Differential Revision: D65280674 fbshipit-source-id: b3ae613ea8f0f4ae20fb6e5e816314b8c10e6c65
This commit is contained in:
parent
9563ef79ca
commit
dd2a11b5fc
@ -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
|
||||
|
@ -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"
|
||||
|
Loading…
x
Reference in New Issue
Block a user