fix: resolve video save path without os.chdir (fixes #378)#448
Open
Haris-bin-shakeel wants to merge 1 commit into
Open
fix: resolve video save path without os.chdir (fixes #378)#448Haris-bin-shakeel wants to merge 1 commit into
Haris-bin-shakeel wants to merge 1 commit into
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #448 +/- ##
==========================================
- Coverage 89.07% 88.90% -0.17%
==========================================
Files 27 27
Lines 1281 1280 -1
==========================================
- Hits 1141 1138 -3
- Misses 140 142 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
743dafb to
588daad
Compare
Author
|
Added |
e240ee8 to
39d4813
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #378 by removing
os.chdir()fromVideoMaker.make_video()and switching to explicit absolute paths throughout the video pipeline.Root Cause
make_video()calledos.chdir(self.save_fld)so ffmpeg could locate the output file using only a bare filename. The CWD was restored at the end — but only on the happy path. Any exception during rendering left the process CWD permanently mutated, causing subsequent path operations in the caller's script to silently resolve to the wrong location. This explains the intermittent nature of the bug._video.pycompounded this by passing only a filename to ffmpeg, making output placement entirely dependent on global CWD state.Changes
brainrender/video.py: removedcurdir = os.getcwd()and bothos.chdir()calls;Video()now receives a fully-resolved absolute path viaself.save_fld.resolve();compress()updated to matchbrainrender/_video.py: ffmpeg input dir and output file both quoted to handle paths with spacestests/test_video.py: assertions updated to validate resolved absolute pathsVerification