Unable to use 'filething' to open files in mutagen.mp3.MP3
| Affects | Status | Importance | Assigned to | Milestone | |
|---|---|---|---|---|---|
| mutagen (Ubuntu) |
Invalid
|
Undecided
|
Unassigned | ||
Bug Description
Hi, I have been trying to 'override' the file open parameters in the MP3 module to improve scan performance of a large music library, using python3-mutagen.
I can't get the supplied example to work: I get the following output:
$ python3 fileobj-gio.py
Traceback (most recent call last):
File "fileobj-gio.py", line 130, in <module>
print(
File "/usr/lib/
with open(filename, "rb") as fileobj:
TypeError: invalid file: <__main_
Looking through the code I can't see how it would treat a 'file-like object' any differently: it seems that open(filename,"rb") will always be called.
What I want to achieve is to understand if different buffering would improve elapsed time to scan large numbers of files. I was hoping to open the file first using different buffering parameter and pass a file-object to MP3, but the only documented way of doing this using open() is by passing the fileno() attribute of an already open file, which also fails on the open statement:
m=MP3(f.fileno())
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/
self.
File "/usr/lib/
with open(filename, "rb") as fileobj:
OSError: [Errno 9] Bad file descriptor
Any advice would be most welcome on either how to fix the bug or other ways to improve scan performance. Thanks for your help.
ProblemType: Bug
DistroRelease: Ubuntu 16.04
Package: python3-mutagen 1.31-1ubuntu1
ProcVersionSign
Uname: Linux 4.4.0-38-generic x86_64
ApportVersion: 2.20.1-0ubuntu2.1
Architecture: amd64
CurrentDesktop: Unity
Date: Fri Sep 30 00:03:20 2016
Dependencies:
PackageArchitec
SourcePackage: mutagen
UpgradeStatus: Upgraded to xenial on 2016-04-22 (160 days ago)

File like object support was added in 1.33.
You can get the newest version in my PPA if needed: https:/ /launchpad. net/~lazka/ +archive/ ubuntu/ ppa
If you find anything else please report it upstream: https:/ /github. com/quodlibet/ mutagen/ issues