sendgrid谷歌应用程序引擎python DistributionNotFound [英] sendgrid google app engine python DistributionNotFound

查看:118
本文介绍了sendgrid谷歌应用程序引擎python DistributionNotFound的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将Sendgrid整合到Google App Engine Python项目中。
$ b

Sendgrid通过pip安装,并从shell命令行正确运行。



我已将sendgrid文件夹复制到我的gae项目文件夹中。

使用相同的示例代码(来自sendgrid-python github页面)在shell中工作,我收到以下错误:

  Traceback(最近一次调用最后一次):
文件C:\Program Files\Google\google_appengine\lib\webapp2-2.5.2\webapp2.py,第1535行,致电
rv = self.handle_exception(request,response,e )
在调用
文件C:\程序文件\Google\google_appengine\lib\webapp2-2.5.2\webapp2.py中,第1529行rv = self.router .dispatch(请求,响应)
文件C:\程序文件\Google\google_appengine\lib\webapp2-2.5.2\webapp2.py,第1278行,在default_dispatcher $ b $中b返回route.handler_adap ter(请求,响应)
在调用
中的文件C:\程序文件\Google\google_appengine\lib\webapp2-2.5.2\webapp2.py,行1102返回handler.dispatch()
文件C:\程序文件\Google\google_appengine\lib\webapp2-2.5.2\webapp2.py,第572行,发送
返回self.handle_exception(e,self.app.debug)
文件C:\程序文件\Google\google_appengine\lib\webapp2-2.5.2\webapp2.py,第570行,发送
返回方法(args,kwargs)
文件C:*** route,第260行,后
sg = sendgrid.SendGridClient('username','password' )
文件C:\appname\sendgrid\sendgrid.py,第36行,在init
self.useragent ='sendgrid /'+ pkg_resources.get_distribution('sendgrid')。version +'; python'
文件C:\ Program Files \Google\google_appengine\lib\setuptools-0.6c11\pkg_resources.py,第311行,在get_distribution
中,如果我sinstance(dist,Requirement):dist = get_provider(dist)
文件C:\程序文件\Google\google_appengine\lib\setuptools-0.6c11\pkg_resources.py,第197行,在get_provider
return working_set.find(moduleOrReq)或require(str(moduleOrReq))[0]
文件C:\ Program Files \Google\google_appengine\lib\setuptools-0.6 c11 \pkg_resources.py,第666行,需要
needed = self.resolve(parse_requirements(requirements))
文件C:\程序文件\Google\google_appengine\lib\\ \\ setuptools-0.6c11 \pkg_resources.py,第565行,解析
raise DistributionNotFound(req)#XXX在此放置更多信息
DistributionNotFound:sendgrid

感谢您的帮助!

编辑:我试过升级并重新安装pip, setuptools,还安装分发和分发。没有工作。我已经通过网络搜索了类似的错误,无论是来自distributionnotfound还是来自pkg_resource并且没有任何东西。编辑2:与'pip install sendgrid'一起安装,我删除了sendgrid并从github sendgrid-python以zip格式下载,然后运行setup.py。最初的结果是一样的,sendgrid从shell运行,但不是从GAE运行。但是,zip下载包含DIST文件夹,如果将其与sendgrid文件夹一起复制到GAE目录中,则会删除DistributionNotFound错误。但是,GAE项目没有发送任何邮件。



谢谢,希望有人有答案。

解决方案

感谢sendgrid-python中的人员解决了这个问题,并对sendgrid-python进行了更新。



4步:


  • 'pip install sendgrid'

  • 'pip install smtpapi'
  • 将sendgrid文件夹和smtpapi文件夹复制到您的GAE目录中

  • 将smtpapi文件夹移入sendgrid文件夹 - 来自github sendgrid-python的示例代码现在可以正确执行,以及如何为GAE提供sendgrid功能。



希望这可以帮助别人。


I am integrating Sendgrid into a Google App Engine Python project.

Sendgrid is installed through pip, and from the shell command line, functions correctly.

I have copied the sendgrid folder into my gae project folder.

Using the same example code (from sendgrid-python github page) that works in the shell, I receive the following error:

Traceback (most recent call last):
File "C:\Program Files\Google\google_appengine\lib\webapp2-2.5.2\webapp2.py", line 1535, in call
rv = self.handle_exception(request, response, e)
File "C:\Program Files\Google\google_appengine\lib\webapp2-2.5.2\webapp2.py", line 1529, in call
rv = self.router.dispatch(request, response)
File "C:\Program Files\Google\google_appengine\lib\webapp2-2.5.2\webapp2.py", line 1278, in default_dispatcher
return route.handler_adapter(request, response)
File "C:\Program Files\Google\google_appengine\lib\webapp2-2.5.2\webapp2.py", line 1102, in call
return handler.dispatch()
File "C:\Program Files\Google\google_appengine\lib\webapp2-2.5.2\webapp2.py", line 572, in dispatch
return self.handle_exception(e, self.app.debug)
File "C:\Program Files\Google\google_appengine\lib\webapp2-2.5.2\webapp2.py", line 570, in dispatch
return method(args, kwargs)
File "C:***route", line 260, in post
sg = sendgrid.SendGridClient('username', 'password')
File "C:\appname\sendgrid\sendgrid.py", line 36, in init
self.useragent = 'sendgrid/' + pkg_resources.get_distribution('sendgrid').version + ';python'
File "C:\Program Files\Google\google_appengine\lib\setuptools-0.6c11\pkg_resources.py", line 311, in get_distribution
if isinstance(dist,Requirement): dist = get_provider(dist)
File "C:\Program Files\Google\google_appengine\lib\setuptools-0.6c11\pkg_resources.py", line 197, in get_provider
return working_set.find(moduleOrReq) or require(str(moduleOrReq))[0]
File "C:\Program Files\Google\google_appengine\lib\setuptools-0.6c11\pkg_resources.py", line 666, in require
needed = self.resolve(parse_requirements(requirements))
File "C:\Program Files\Google\google_appengine\lib\setuptools-0.6c11\pkg_resources.py", line 565, in resolve
raise DistributionNotFound(req) # XXX put more info here
DistributionNotFound: sendgrid

Thanks for your help!

EDIT: I have tried upgrading and re-installing pip and setuptools, also installing distribute and distribution. Nothing worked. I have searched through the web for similar errors, whether from distributionnotfound or from pkg_resource and nothing.

EDIT 2: Instead of installing with 'pip install sendgrid', I removed sendgrid and downloaded by zip from github sendgrid-python, then running setup.py. Initially the results were the same, sendgrid works from shell, but not from GAE. However, the zip download includes a DIST folder, which if copied into the GAE directory along with the sendgrid folder, removes the DistributionNotFound error. BUT, no mail is sent from the GAE project.

Thanks, hope someone has an answer.

解决方案

Thanks to the guys at sendgrid-python this issue is resolved, with an update to sendgrid-python.

4 steps:

  • 'pip install sendgrid'
  • 'pip install smtpapi'
  • copy sendgrid folder and smtpapi folder into your GAE directory
  • move smtpapi folder into sendgrid folder - example code from github sendgrid-python now executes correctly and how you have sendgrid functionality for GAE.

Hope this helps someone.

这篇关于sendgrid谷歌应用程序引擎python DistributionNotFound的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆