Cannot save changes : OSError: [Errno 9] Bad file descriptor

For all files,I am unable to save tags, or change file names or move files. If any of these save options are checked, it fails.

I have confirmed that file modify permissions are granted and files are not read-only. Happens for all files.

It unknown when the problem started. I may be coincidence, but I noticed it after upgrade to latest stable version 2.2.3. I reverted to the previous version, but the problem persisted.

D: 19:38:59,114 formats.id3._save:345: Saving file ‘G:\Users\Public\Music\Gil Shaham, Akira Eguchi, Brinton Smith\The Faure Album\01 Sonata in A major, Op.13, No.1, 1. Allegro molto.mp3’
E: 19:38:59,124 util.thread.run:56: Traceback (most recent call last):
File “site-packages\mutagen_util.py”, line 169, in wrapper
File “site-packages\mutagen_util.py”, line 140, in wrapper
File “site-packages\mutagen\id3_file.py”, line 268, in save
File “site-packages\mutagen_util.py”, line 849, in insert_bytes
File “site-packages\mutagen_util.py”, line 768, in resize_file
OSError: [Errno 9] Bad file descriptor

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “picard\util\thread.py”, line 52, in run
File “picard\file.py”, line 264, in _save_and_rename
File “picard\formats\id3.py”, line 509, in _save
File “picard\formats\id3.py”, line 615, in _save_tags
File “site-packages\mutagen_util.py”, line 173, in wrapper
File “site-packages\mutagen_compat.py”, line 86, in reraise
File “site-packages\mutagen_util.py”, line 169, in wrapper
File “site-packages\mutagen_util.py”, line 140, in wrapper
File “site-packages\mutagen\id3_file.py”, line 268, in save
File “site-packages\mutagen_util.py”, line 849, in insert_bytes
File “site-packages\mutagen_util.py”, line 768, in resize_file
mutagen.id3._util.error: [Errno 9] Bad file descriptor

D: 19:38:59,138 file.update:568: Updating file <MP3File ‘01 Sonata in A major, Op.13, No.1, 1. Allegro molto.mp3’>

Upon further investigation, the folders in the path are read-only. For unknown reason, when I uncheck read-only, click apply and OK, then recheck the properties, they go back to read only. I blame Windows for protecting me from myself. I haven’t figure this out yet.

1 Like

Found the cause.

Windows Security feature “Ransomware Protection” “Controlled Folder Access” was preventing read/write to the folders. I remember installing the Windows Update and appreciate what it does. however, it would have been nice if it came with an alert.

2019-12-01 15_38_37-Window

2 Likes

Thanks a lot for sharing your findings, likely others wi run into simar issues.

I wonder why it does prevent the public user fder from changes? That looks like a strange functionality, but maybe we misunderstand how MS intents this folder to be used :slight_smile:

No one can ever work out what Microsoft think they are doing… :rofl:

Notice there is an option there to “Allow an app through Controlled folder access”. That may be enough to let Picard free reign.

I expect Picard has triggered a panic from the MS AV Ransomware protection as it started changing lots of files all at the same time. The kind of pattern that Ransomware would also produce.

1 Like