使用python fabric的run方法,返回值乱码
PHP中文网
PHP中文网 2017-04-18 10:00:11
0
2
856
#!/usr/bin/env python
# encoding: utf-8

from fabric.api import local,lcd,cd,run, env

env.hosts=['test@10.0.0.111',]
env.password = 'qaz123...'
env.shell="cmd /c"

        
def task1():
    result = run("c:/a.bat")
    if result.succeeded:
        print('sucess...........')
        
    E:\Projects\Python>fab task1

[test@10 .0.0.111] Executing task 'task1'
[test@10 .0.0.111] run: c:/a.bat
[test@10 .0.0.111] out: (B)0[?7l[H[J[2;1HC:Userstest.WIN-37PI8F6KV0N>cd.1>1.txt [4;1HC:Userstest.WIN-37PI8F6KV
0N>11[5;1H'11' 涓?[5;8H鏄?[5;10H鍐?[5;12H閮?[5;14H鎴?[5;16H澶?[5;18H閮?[5;20H鍛?[5;22H浠?[5;24H锛?[5;26H涔?[5;28H涓?[5;
30H鏄?[5;32H鍙?[5;34H杩?[5;36H琛?[5;38H鐨?[5;40H绋?[5;42H搴?[6;1H鎴?[6;3H鎵?[6;5H澶?[6;7H鐞?[6;9H鏂?[6;11H浠?[6;13H銆?[7
;1H[?7h

上面是代码,下面的跑完任务的输出信息,求大神指导

PHP中文网
PHP中文网

认证0级讲师

reply all(2)
洪涛

The ssh server using the Linux kernel has no garbled characters, but the ssh server using the window has garbled characters. How to solve it?

伊谢尔伦

Not garbled characters, but command line output control characters, etc.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template