如何修复“AttributeError: 'module' object has no attribute 'SOL_UDP'";Python 连接器 Mule 中的错误 [英] How to fix "AttributeError: 'module' object has no attribute 'SOL_UDP'" error in Python Connector Mule

查看:60
本文介绍了如何修复“AttributeError: 'module' object has no attribute 'SOL_UDP'";Python 连接器 Mule 中的错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试执行一个基本脚本以将 Cisco 配置文件作为 JSON 格式返回,并且我在 Python2.7.16 和 Python 3.7.3 上有一个成功的过程,但是当我尝试执行相同的脚本时适用于 Mule ESB 的 Python 连接器我收到此线程标题中提到的错误.

I'm trying to execute a basic script to return Cisco Config File as a JSON Format, and I have a success process over Python2.7.16 and Python 3.7.3, but when I'm trying to execute the same script over Python Connector for Mule ESB I receive the error refered in the title of this thread.

这是针对 Mule 功能的,此工具中的 Python 连接器脚本可与 Jython 2.7.1 配合使用,并作为 Mule 的库加载.

This is for a Mule feature, the Python connector script in this tool, works with a Jython 2.7.1, and is loaded as a library for the Mule.

我希望输出为 JSON 文件,但实际输出为:

I expect the output as a JSON file but actual output is:

Root Exception stack trace:
Traceback (most recent call last):
  File "<script>", line 2, in <module>
  File "C:\Python27\Lib\site-packages\ciscoconfparse\__init__.py", line 1, in <module>
    from ciscoconfparse import *
  File "C:\Python27\Lib\site-packages\ciscoconfparse\ciscoconfparse.py", line 17, in <module>
    from models_cisco import IOSHostnameLine, IOSRouteLine, IOSIntfLine
  File "C:\Python27\Lib\site-packages\ciscoconfparse\models_cisco.py", line 8, in <module>
    from ccp_util import _IPV6_REGEX_STR_COMPRESSED1, _IPV6_REGEX_STR_COMPRESSED2
  File "C:\Python27\Lib\site-packages\ciscoconfparse\ccp_util.py", line 16, in <module>
    from dns.resolver import Resolver
  File "C:\Python27\Lib\site-packages\dns\resolver.py", line 1148, in <module>
    _protocols_for_socktype = {
AttributeError: 'module' object has no attribute 'SOL_UDP'

推荐答案

我唯一需要做的就是在脚本 resolver.py 中注释该行,这样 Anypoint Studio 上的脚本就可以顺利运行了.

The only thing I had to do was comment that line in the script resolver.py and in this way the script on Anypoint Studio ran smoothly.

感谢您的帮助,我希望这对其他人有所帮助.

Thanks for your help, I hope that this helps to other people.

这篇关于如何修复“AttributeError: 'module' object has no attribute 'SOL_UDP'";Python 连接器 Mule 中的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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