python版本问题,iotop执行错误except ImportError, e:解决

2018-7-2 fredzeng linux

# iotop 
  File "/usr/sbin/iotop", line 10
    except ImportError, e:
                      ^
SyntaxError: invalid syntax
[root@eanquan ~]# vi /usr/sbin/iotop 
#!/usr/bin/python
# iotop: Display I/O usage of processes in a top like UI
# Copyright (c) 2007, 2008 Guillaume Chazarain <guichaz@gmail.com>, GPLv2
# See iotop --help for some help

import sys

try:
    from iotop.ui import main
except ImportError, e:
    print e
    print 'To run an uninstalled copy of iotop,'
    print 'launch iotop.py in the top directory'
else:
    try:
        main()
    except KeyboardInterrupt:
        pass

    sys.exit(0)

# ll /usr/bin/python2*0 B/s  0.00 %  0.00 % [md/1]
lrwxrwxrwx. 1 root root       6 Jul  8  2016 /usr/bin/python2 -> python
-rwxr-xr-x. 2 root root    4864 Jan 22  2014 /usr/bin/python2.6
-rwxr-xr-x  1 root root 6273947 Dec  4  2017 /usr/bin/python2.7

执行python的#!/usr/bin/python 改为

#!/usr/bin/python2.6就可以

标签: python iotop


版权所有:《DNS服务器IP地址,域名注册,CDN加速技术,linux,web服务器》 => 《python版本问题,iotop执行错误except ImportError, e:解决
本文地址:http://www.dnsdizhi.com/post-354.html
除非注明,文章均为 《DNS服务器IP地址,域名注册,CDN加速技术,linux,web服务器》 原创,欢迎转载!转载请注明本文地址,谢谢。

发表评论:

Powered by emlog sitemap