这是我第二次尝试寻求帮助。我只是想用PNG转换PDF附件,没有成功。
这是我的代码:
class FAX(db.Expando):
date = db.DateTimeProperty(auto_now_add=True)
class LogSenderHandler(InboundMailHandler):
def receive(self, mail_message):
for elemento in mail_message.attachments:
asset = conversion.Asset("application/pdf", str(elemento[1]), "Fax.pdf")
conversion_obj = conversion.Conversion(asset, "image/png")
result = conversion.convert(conversion_obj)
for elemento2 in result.assets:
fax = FAX()
fax.immagine = elemento2.data
fax.put()
def main():
application = webapp.WSGIApplication([LogSenderHandler.mapping()], debug=True)
wsgiref.handlers.CGIHandler().run(application)
if __name__ == '__main__':
main()
这是日志:
0.1.0.20 - - [05/Apr/2012:02:04:33 -0700] "POST /_ah/mail/fax@faxmeraviglie.appspotmail.com HTTP/1.1" 200 124 - - "faxmeraviglie.appspot.com" ms=558 cpu_ms=163 api_cpu_ms=0 cpm_usd=0.010690 loading_request=1 instance=00c61b117c45eeb741ec2540095a8ba3862842