[Python] Netmiko - Script terminates before finish's the command

Discussão em 'Python' iniciado por Stack, Junho 1, 2025.

  1. Stack

    Stack Membro Participativo

    I'm trying to copy an image from tftp server to my switch but the script terminates before completing the move, here is the code and the output.

    hostname = connection.send_command ('copy tftp://TFTP1/c3560cx-universalk9-mz.152-7.E12.bin flash:/c3560cx-universalk9-mz.152-7.E12.bin', expect_string=r"Destination filename",read_timeout=500)

    print(hostname)

    hostname = connection.send_command("\n", expect_string="Loading", )

    print(hostname)

    ------------- output ----------------

    Connected Successfully to Switch1

    Destination filename [c3560cx-universalk9-mz.152-7.E12.bin]?

    Accessing tftp://TFTP1/c3560cx-universalk9-mz.152-7.E12.bin...

    Loading c3560cx-universalk9-mz.152-7.E12.bin from 10.10.10.10 (via Vlan1): !

    PS C:\Users\Test\Desktop\py>

    what am I missing ?

    Thank you in advance !

    Continue reading...

Compartilhe esta Página