dpepbjp126917 2017-06-28 02:28
浏览 239

Python脚本不在Web浏览器中运行

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 + '
'
"Model:" + device_type +'
'
"IOS:" + source_file + '
')
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 ("

")
print ("dir")
output = ssh_conn.send_command("dir")
print (">> " + output + '
')
scp_conn = SCPConn(ssh_conn)
print ("Copying files...
Please wait for a while... 
")
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:

Error

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥30 这是哪个作者做的宝宝起名网站
    • ¥60 版本过低apk如何修改可以兼容新的安卓系统
    • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
    • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
    • ¥50 有数据,怎么用matlab求全要素生产率
    • ¥15 TI的insta-spin例程
    • ¥15 完成下列问题完成下列问题
    • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
    • ¥15 YoloV5 第三方库的版本对照问题
    • ¥15 请完成下列相关问题!