cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
377
Views
0
Helpful
0
Replies

C9300 - Problems with executing TCL script using Python "cli" library

malyj
Level 1
Level 1

Hello everyone!

I am trying to execute TCL WoL script using Python3 and "cli" library, that is running inside Guestshell on Catalyst 9300 IOS XE.

In my running-config I have specified:

'scripting tcl init flash:wol.tcl'

so after executing "tclsh" I can run "WakeOnLan xxx.xxx.xxx.xxx xxxxxxxxxxxx" and it sends MagicPacket.

But here is the problem. When I start Python console using "guestshell run python3", then "import cli" to import library and finally command 'cli.cli("tclsh ; WakeOnLan xxx.xxx.xxx.xxx xxxxxxxxxxxx") it show this error message:

 

Spoiler
Traceback (most recent call last):  
  File "/usr/lib/python3.6/site-packages/cli/__init__.py", line 340, in cli     
    subprocess.check_output(cmdline, stderr=subprocess.STDOUT, shell=True)    
  File "/usr/lib64/python3.6/subprocess.py", line 356, in check_output      
    **kwargs).stdout             
  File "/usr/lib64/python3.6/subprocess.py", line 438, in run   
    output=stdout, stderr=stderr)      
subprocess.CalledProcessError: Command 'iosp_client -om 3 -o /tmp/.iosp_2023_06_08_09_32_
09_233542_735378408.output -i /tmp/.iosp_2023_06_08_09_32_09_233542_735378408.cmd' return
ed non-zero exit status 1.      
    
During handling of the above exception, another exception occurred:    
            
Traceback (most recent call last):                                 
  File "<stdin>", line 1, in <module>                                            
  File "/usr/lib/python3.6/site-packages/cli/__init__.py", line 350, in cli             
    raise IOSPCLIError                                                             
cli.IOSPCLIError: CLI syntax error or execution Failure

For me it seems like that TCL init script won't load when "tclsh" is executed using Python cli command.

I would be grateful for any ideas on how to solve this problem. Thanks!

 

 

0 Replies 0