The Definitive Guide to Jython 的附录 A 描述了下载 SetupTools 以与 Jython 一起使用。
https://jython.readthedocs.io/en/latest/appendixA/
这向我表明应该可以从 Maximo 的 Jython 自动化脚本中下载和使用 SetupTools(在我的例子中是 v7.6)。这本书将我们指向以下 URL 以复制将执行此操作的 Jython 脚本:
http://peak.telecommunity.com/dist/ez_setup.py
我在上面的脚本中添加一行来调用函数“use_setuptools”:
use_setuptools()
Run Code Online (Sandbox Code Playgroud)
然后我在 Maximo 应用程序上创建一个按钮并将上述脚本与按钮按下相关联,我收到以下错误:
系统消息 BMXAA7837E - 发生错误,导致 EZ_SETUP 启动点的 EZ_SETUP 脚本无法运行。urllib2.HTTPError: HTTP 错误 403: SSL is required in at line number 280
堆栈跟踪指向由“use_setuptools”调用的函数“download_setuptools”中的以下行:
src = urllib2.urlopen(url)
Run Code Online (Sandbox Code Playgroud)
这似乎是因为请求的 url,在我的情况下:
http://pypi.python.org/packages/2.5/s/setuptools/setuptools-0.6c11-py2.5.egg
...在到达以下网址之前重定向了几次:
请注意,该 url 使用 HTTPS 而不是 HTTP。以下说明了为什么会这样:
https://sourceforge.net/p/pypi/support-requests/300/
Maximo 包含的 jython.jar 不包含 ssl 模块,因此我们可以: