1

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'
Esteban
  • 71
  • 1
  • 9

2 Answers2

2

resolver.py

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.

Esteban
  • 71
  • 1
  • 9
0

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.

aled
  • 21,330
  • 3
  • 27
  • 34
  • Thanks Alejandro, I finally found a solution, I had to comment the line of the library where that parameter was requested, which made the Anypoint flow work without problem, now I have problems to deploy in cloudhub, I do not know in which path the library should load ciscoconfparse for that can read it from cloudhub. – Esteban May 20 '19 at 19:42
  • 1
    You don't have any access to install libraries in CloudHub. You should package everything that the application needs in the application, for example in the src/main/resources directory or a jar library. Otherwise it will not be accessible to it. – aled May 20 '19 at 21:56
  • Thanks Alejandro, I have an example with the ciscoconfparse library running success over cloudhub, Thanks :) – Esteban May 20 '19 at 22:03