码迷,mamicode.com
首页 > Web开发 > 详细

fence_vmware_soap UnicodeEncodeError

时间:2019-03-23 13:01:10      阅读:223      评论:0      收藏:0      [点我收藏+]

标签:erro   soa   tde   encoding   can   ast   most   war   position   

执行如下命令

fence_vmware_soap -z -l administrator@vsphere.local -p 2wsx@QAZ -a 10.0.2.200 -o list --ssl-insecure | grep GFSCluster

Traceback (most recent call last):
  File "/usr/sbin/fence_vmware_soap", line 256, in <module>
    main()
  File "/usr/sbin/fence_vmware_soap", line 250, in main
    result = fence_action(conn_global, options_global, set_power_status, get_power_status, get_power_status)
  File "/usr/share/fence/fencing.py", line 872, in fence_action
    print(outlet_id + options["--separator"] + alias)
UnicodeEncodeError: ‘ascii‘ codec can‘t encode characters in position 10-11: ordinal not in range(128)

解决方案:

# encoding: utf-8
import codecs

并在840行的fence_action开头加入下面内容。
if sys.stdout.encoding != ‘UTF-8‘:
    sys.stdout = codecs.getwriter(‘utf-8‘)(sys.stdout, ‘strict‘)
if sys.stderr.encoding != ‘UTF-8‘:
   sys.stderr = codecs.getwriter(‘utf-8‘)(sys.stderr, ‘strict‘)

 

fence_vmware_soap UnicodeEncodeError

标签:erro   soa   tde   encoding   can   ast   most   war   position   

原文地址:https://www.cnblogs.com/longchang/p/10583370.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!