开发者

How to use gnomevfs.get_mime_type()?

开发者 https://www.devze.com 2023-04-07 12:21 出处:网络
Python gnome binding have gnomevfs module that theoretically can get MIME types. But calling gnomevfs.get_mime_type() with any name other than \"/dev/null\" raises err开发者_开发知识库or \"RuntimeErro

Python gnome binding have gnomevfs module that theoretically can get MIME types. But calling gnomevfs.get_mime_type() with any name other than "/dev/null" raises err开发者_开发知识库or "RuntimeError: there was an error reading the file". For example:

import gnomevfs
gnomevfs.get_mime_type( "/tmp/a.py" )
gnomevfs.get_mime_type( "file://tmp/a.py" )
gnomevfs.get_mime_type( "file:///tmp/a.py" )
gnomevfs.get_mime_type( "file://./tmp/a.py" )

This all fails. With any file / folder name except "/dev/null" :(. /tmp/a.py exists and acessible. Any suggestions?


It works for me. Have you tried with other files in other directories? Are you sure that the user under which Python is being run has access to /tmp/a.py?

0

精彩评论

暂无评论...
验证码 换一张
取 消