Skip to content

Commit dd2a11b

Browse files
bottlerfacebook-github-bot
authored andcommitted
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
1 parent 9563ef7 commit dd2a11b

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

pytorch3d/io/off_io.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ def _read_faces_lump(
8484
)
8585
data = np.loadtxt(file, dtype=np.float32, ndmin=2, max_rows=n_faces)
8686
except ValueError as e:
87-
if n_faces > 1 and "Wrong number of columns" in e.args[0]:
87+
if n_faces > 1 and "number of columns" in e.args[0]:
8888
file.seek(old_offset)
8989
return None
9090
raise ValueError("Not enough face data.") from None

tests/test_io_off.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -286,15 +286,15 @@ def load(lines):
286286

287287
lines2 = lines.copy()
288288
lines2[0] = "6 2 0"
289-
with self.assertRaisesRegex(ValueError, "Wrong number of columns at line 5"):
289+
with self.assertRaisesRegex(ValueError, "number of columns"):
290290
load(lines2)
291291

292292
lines2[0] = "5 1 0"
293-
with self.assertRaisesRegex(ValueError, "Wrong number of columns at line 5"):
293+
with self.assertRaisesRegex(ValueError, "number of columns"):
294294
load(lines2)
295295

296296
lines2[0] = "16 2 0"
297-
with self.assertRaisesRegex(ValueError, "Wrong number of columns at line 5"):
297+
with self.assertRaisesRegex(ValueError, "number of columns"):
298298
load(lines2)
299299

300300
lines2[0] = "3 3 0"
@@ -312,7 +312,7 @@ def load(lines):
312312

313313
lines2 = lines.copy()
314314
lines2[2] = "7.3 4.2 8.3 932"
315-
with self.assertRaisesRegex(ValueError, "Wrong number of columns at line 2"):
315+
with self.assertRaisesRegex(ValueError, "number of columns"):
316316
load(lines2)
317317

318318
lines2[1] = "7.3 4.2 8.3 932"

0 commit comments

Comments
 (0)