View Single Post
qwerty12's Avatar
Posts: 4,274 | Thanked: 5,358 times | Joined on Sep 2007 @ Looking at y'all and sighing
#227
Originally Posted by qole View Post
Does anyone know how to do this in Python? What library would one use?
python-gnome was already installed here, so this worked:
from gnome import gnomevfs
print "%s" % gnomevfs.get_mime_type("/home/user/MyDocs/treeview-tutorial.pdf")

Python also has a standard mimetypes module if an external dependency is not your thing.

(Sorry it's not got CODE tags around it, but my JS is disabled in Tear and the symbol input fails to come up if the clipboard is populated)
 

The Following 2 Users Say Thank You to qwerty12 For This Useful Post: