How to fix “AttributeError: 'module' object has no attribute 'SOL_UDP'” error in Python Connector Mule

流过昼夜 提交于 2021-02-19 08:45:44

问题


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.

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.

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'

回答1:


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.




回答2:


The problem appears to be that you are trying to execute a script that depends on a different python package. Mule supports executing python scripts using the Java Jython implementation but it probably doesn't know about pyhton packages dependencies.



来源:https://stackoverflow.com/questions/56085834/how-to-fix-attributeerror-module-object-has-no-attribute-sol-udp-error-in

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!