Comments (5)
The error message: (PermissionError: [WinError 32] The process cannot access the file because it is being used by another process
) indicates that some process is still using a file or directory in the folder you're trying to remove with shutil.rmtree()
.
This is because stemgen is using os.chdir(os.path.join(OUTPUT_PATH, FILE_NAME))
to change the current working directory. If the Python process (or any other running process) is in the directory you're trying to delete, you'll get a permission error. Before removing the directory, you should change back to some other directory.
I made a pull request (#39) with the following changes to the cleanup process:
Bug Fix:
- Move out of the Target Directory to be cleaned: Before attempting to remove the directory, I changed the current working directory to
OUTPUT_PATH
to ensure we are not inside the directory we're trying to delete.
Minor Improvements - Path Handling: Improved the way paths are constructed using
os.path.join()
consistently instead of a mix of string concatenation and joining. This ensures paths are constructed in a platform-independent manner. - Error Handling: Added a
try-except
block around theshutil.rmtree()
call. If aPermissionError
occurs, a message is printed indicating the directory might still be in use. This provides a clearer error message and ensures the script doesn't crash due to this specific error. - Checking for Stem File: Modified the path for checking and renaming the stem file to ensure it's constructed correctly.
I also added the following improvement for windows users with a GPU:
- Automatic GPU Detection: Script now does a check to see if CUDA is available. If so, it will use the GPU by default (can be overridden by using the
-d
/--device
flag).
If no CUDA support is detected, the script will use the CPU instead.
from stemgen.
Thank you for the report! It is a known (and annoying) issue.
I'm not familiar enough with Windows to understand and fix this quickly, I need to dig. PRs are welcomed! This is a good first issue, if you ever want to try to fix it :)
from stemgen.
FWIW, Demucs without any -d flag defaults to CUDA-if-available-otherwise-CPU.
from stemgen.
@awesomer, yes but there isn't a way of doing that without changing the code because "cpu" is set as the default value in argparse. So if I omit the -d
flag, stemgen defaults back to -d cpu
from stemgen.
Related Issues (20)
- [Feature Request] traktor4 metadata HOT 6
- ni-stem errors on linux HOT 1
- [Feature Request] GUI HOT 3
- [Feature Request] Windows Support HOT 10
- [Feature Request] MP3 support HOT 9
- [Note] ALAC stems can't be read on Windows within Traktor HOT 3
- Sweep(slow): Review the codebase and make suggestions to make the code more readable and Pythonic HOT 1
- Sweep(slow): Review the codebase and make suggestions to make the code more readable and Pythonic HOT 1
- Sweep: Refactor ableton.py to be cleaner, extracting any methods you can into separate files if that makes sense HOT 1
- Sweep: Add comments and docstrings to ableton.py. Clarify each method and global HOT 1
- Mutagen missing in installation instructions HOT 1
- Converting multiple songs at once? HOT 3
- [Feature request] Extract only vocals and instrumental HOT 2
- Error opening input: No such file or directory HOT 8
- How to know if qaac encoder is used on Windows? HOT 2
- [Feature request] Custom name & color for stem HOT 2
- [Feature Request] Following the Stem File Specification HOT 1
- [Bug] ALAC stems can't be read on Windows within Traktor HOT 4
- [Feature Request] GPU acceleration HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from stemgen.