在我的Python Shell中,我可以执行以下操作:
>>> import mimetypes
>>> mimetypes.guess_type("ulla.svg")
('image/svg+xml', None)
在本地运行代码时,它表现如预期。然而,当在Google App Engine上运行相同的代码(或者至少是相同的示例)时,返回值为(None, None)
class TestHandler(webapp2.RequestHandler):
def get(self):
import mimetypes
self.response.out.write(mimetypes.guess_type("ulla.svg"))
我做错了吗?:)
顺便说一下 - 我的Macbook终端使用的是Python 2.7版本,在应用程序引擎上也是2.7版本。