[Bug 1629131] Re: Unable to use 'filething' to open files in mutagen.mp3.MP3
Simon Lambourn
simon.lambourn at gmail.com
Fri Sep 30 09:03:07 UTC 2016
Christoph,
Don't worry - it was an interesting exercise. I've upgraded from your
PPA, and I look forward to trying it out.
Simon
On Fri, 30 Sep 2016 at 10:01 Christoph Reiter <1629131 at bugs.launchpad.net>
wrote:
> No problem. The docs should have a note mentioning when it was
> introduced I guess.
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1629131
>
> Title:
> Unable to use 'filething' to open files in mutagen.mp3.MP3
>
> Status in mutagen package in Ubuntu:
> Invalid
>
> 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(mutagen.File(mutagen_file).pprint())
> File "/usr/lib/python3/dist-packages/mutagen/_file.py", line 239, in
> File
> with open(filename, "rb") as fileobj:
> TypeError: invalid file: <__main__.GioMutagenFile object at
> 0x7f204fba4be0>
>
> 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/python3/dist-packages/mutagen/_file.py", line 42, in
> __init__
> self.load(filename, *args, **kwargs)
> File "/usr/lib/python3/dist-packages/mutagen/id3/__init__.py", line
> 1092, in load
> 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
> ProcVersionSignature: Ubuntu 4.4.0-38.57-generic 4.4.19
> 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:
>
> PackageArchitecture: all
> SourcePackage: mutagen
> UpgradeStatus: Upgraded to xenial on 2016-04-22 (160 days ago)
>
> To manage notifications about this bug go to:
>
> https://bugs.launchpad.net/ubuntu/+source/mutagen/+bug/1629131/+subscriptions
>
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to mutagen in Ubuntu.
https://bugs.launchpad.net/bugs/1629131
Title:
Unable to use 'filething' to open files in mutagen.mp3.MP3
Status in mutagen package in Ubuntu:
Invalid
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(mutagen.File(mutagen_file).pprint())
File "/usr/lib/python3/dist-packages/mutagen/_file.py", line 239, in File
with open(filename, "rb") as fileobj:
TypeError: invalid file: <__main__.GioMutagenFile object at 0x7f204fba4be0>
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/python3/dist-packages/mutagen/_file.py", line 42, in __init__
self.load(filename, *args, **kwargs)
File "/usr/lib/python3/dist-packages/mutagen/id3/__init__.py", line 1092, in load
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
ProcVersionSignature: Ubuntu 4.4.0-38.57-generic 4.4.19
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:
PackageArchitecture: all
SourcePackage: mutagen
UpgradeStatus: Upgraded to xenial on 2016-04-22 (160 days ago)
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/mutagen/+bug/1629131/+subscriptions
More information about the foundations-bugs
mailing list