fix: make image save path platform-independent#307
fix: make image save path platform-independent#307raphy0316 wants to merge 1 commit intorobotmcp:developfrom
Conversation
Tyrrnien81
left a comment
There was a problem hiding this comment.
I checked the diff, and replacing ./camera with a fixed path utility makes sense for solving the uvx permission error. The priority order in get_camera_dir() looks reasonable.
One thing I noticed: topics.py (lines 388 and 539) still reads from ./camera/received_image.jpeg, but websocket.py now saves to a different path through get_fixed_image_path(). This means subscribe_once and subscribe_for_duration won't find the saved image after this change. The fix should be straightforward since it just needs the same import and path update in topics.py.
Also, platformdirs isn't in pyproject.toml, so the tempdir fallback will always be used on a normal install. Could be worth adding it as a dependency later.
The core fix is solid, so approving. The topics.py part can be a follow-up.
|
Please update the base branch e check format and linting errors. |
…ted permission errors
c7f1c5a to
1275af7
Compare
|
@stex2005 Thank you for letting me know. I've updated the PR and cleaned up the commits as well. |
Summary
Fix image saving failure in
uvxexecution caused by CWD-dependent relative path (./camera).Problem
Running:
results in:
Permission denied: './camera'But local execution works:
Root Cause
Image saving relied on a relative path:
./camera/received_image.jpeg
This depends on the current working directory (CWD), which differs between:
As a result, the same relative path may resolve to different filesystem locations depending on how the server is launched. In packaged or client-managed execution, it can point to a directory that does not exist or is not writable, which leads to errors such as:
Permission denied: './camera'
Solution
Support:
Changes
Result
Testing
Tested using a locally built package via uv to simulate packaged execution.
Verified:
Related
Closes #301