I'm running this python script wherein the output of the python script will be display in web browser so I'm using PHP for this. I'm using netmiko in python for upgrading the router. The main problem is when I run the python script in CMD it perfectly works but when I run it in Web browser using some html and php not all the script is not running. It gives me the below error:
scp.SCPException: scp: c7200-ipbasek9-mz.150-1.M10.bin: No such file or directory
This is the code in python with netmiko
from netmiko import ConnectHandler, cisco
from netmiko import FileTransfer
from netmiko import SCPConn
from datetime import datetime
import sys
ip_addr = Type[0]
device_type = Type[1]
password = Type[2]
source_file = Type[3]
print ("IP:" + ip_addr + '\n'
"Model:" + device_type +'\n'
"IOS:" + source_file + '\n')
start_time = datetime.now()
s_file = source_file
d_file = source_file
net_device = {
'device_type': 'cisco_ios',
'ip': ip_addr,
'username': 'admin',
'password': password,
'port': 22,
}
ssh_conn = ConnectHandler(**net_device)
print ("\n\n")
print ("dir")
output = ssh_conn.send_command("dir")
print (">> " + output + '\n')
scp_conn = SCPConn(ssh_conn)
print ("Copying files...\nPlease wait for a while... \n")
scp_conn.scp_transfer_file(s_file, d_file)
When I run this in web browser, it stops here in the copying files and it gives me this error: