Aaah! So much time spent trying different ways of getting this to work and such a simple mistake! Thank you for the quick reply, and I'm sorry to have bothered you with this.
Great package... Simon On Fri, 30 Sep 2016 at 08:35 Christoph Reiter <1629...@bugs.launchpad.net> wrote: > 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 > > ** Changed in: mutagen (Ubuntu) > Status: New => Invalid > > -- > 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 Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1629131 Title: Unable to use 'filething' to open files in mutagen.mp3.MP3 To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/mutagen/+bug/1629131/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs