Skip to content

fix: PointCloud.Read() double-joins a caller-supplied "data/" prefix - #92

Merged
petercorke merged 1 commit into
mainfrom
fix/pointcloud-read-data-prefix
Aug 16, 2026
Merged

fix: PointCloud.Read() double-joins a caller-supplied "data/" prefix#92
petercorke merged 1 commit into
mainfrom
fix/pointcloud-read-data-prefix

Conversation

@petercorke

Copy link
Copy Markdown
Owner

Summary

  • PointCloud.Read('data/bunny.ply') fails with ValueError: file ('data', 'data/bunny.ply') not found locally or in mvtbdata, even though mvtbdata/data/bunny.ply genuinely exists in the installed package.
  • Root cause: Read() hardcodes "data" as the mvtbdata subfolder via mvtb_path_to_datafile("data", filename). The documented/intended convention is a bare filename (PointCloud.Read('bunny.ply')), but both of the book's own figure-generation scripts (figures/code/chapter14/fig14_43.py, fig14_44.py) call Read('data/bunny.ply') with a redundant data/ prefix -- an older convention that predates mvtb_path_to_datafile's current auto-prefixing design. That redundant prefix makes the lookup search for mvtbdata/data/data/bunny.ply, which doesn't exist.
  • Fix strips a leading data path component before joining, so both forms resolve to the same file -- keeps the book's existing example scripts working without requiring readers to edit them.

Test plan

  • tests/test_pointcloud.py::TestPointCloud::test_read (new) -- covers both Read('bunny.ply') and Read('data/bunny.ply'), asserts identical point count
  • Full test suite: 820 passed, 71 skipped, no regressions
  • Manually verified against RVC3-python's chap14.ipynb notebook (bunny_pcd = PointCloud.Read('bunny.ply'))

🤖 Generated with Claude Code

@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 0 complexity · 0 duplication

Metric Results
Complexity 0
Duplication 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

Read() hardcodes "data" as the mvtbdata subfolder via
mvtb_path_to_datafile("data", filename) -- the documented convention is
that callers pass a bare filename (PointCloud.Read('bunny.ply')). But
both of the book's own figure-generation scripts
(figures/code/chapter14/fig14_43.py, fig14_44.py) call
PointCloud.Read('data/bunny.ply') with a redundant "data/" prefix, a
convention that predates mvtb_path_to_datafile's current auto-prefixing
design. That redundant prefix made the lookup search for
mvtbdata/data/data/bunny.ply, which doesn't exist, even though
mvtbdata/data/bunny.ply is genuinely present in the package.

Strip a leading "data" path component before joining, so both
PointCloud.Read('bunny.ply') and PointCloud.Read('data/bunny.ply')
resolve to the same file.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@petercorke
petercorke force-pushed the fix/pointcloud-read-data-prefix branch from c8d054d to fff671c Compare August 16, 2026 02:28
@petercorke
petercorke merged commit 576ff70 into main Aug 16, 2026
29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant