[clug] MTP and Python - any ideas?

Paul Wayper paulway at mabula.net
Wed May 4 21:30:02 UTC 2016

On 02/05/16 21:20, Chris Smart wrote:
> On Mon, May 02, 2016 at 08:41:00PM +1000, Paul Wayper wrote:
>> Hi all,
>> Is anyone familiar with using libmtp to interface with MTP devices?  I'm
>> trying to write a program to get some information from my phone, but while the
>> kernel's usbfs module seems quiet happy to see the phone's file systems and
>> MATE's file manager can browse the device, my simple "get the device name and
>> free space" program doesn't get much further than the attempting to connect.
> [snip]
>> Any ideas?
> This could be because your phone is already in use by nautilus. Can you
> try ejecting it from nautilus and re-run your program?

One of the points about MTP is that it allows multiple programs to talk to the
storage on the device, as well as the device itself to see its own storage.
That's why Nautilus and Rhythmbox can both see the music on your phone at the
same time.

I haven't tried running it as root, but neither is Nautilus AFAICS.

Have fun,


More information about the linux mailing list