执行如下命令

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的更多相关文章

  1. Python编码问题:UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-1: ordinal not in range(12

    今天安装了PyScripter编辑器,刚要写代码,突然就出现异常: <span style="font-size:14px;color:#ff0000;">>&g ...

  2. python+selenium运行报错UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-1: ordinal not in range(128)

    使用python+selenium运行自动化脚本时,打印某一段文字出现UnicodeEncodeError: 'ascii' codec can't encode characters in posi ...

  3. 解决python3 UnicodeEncodeError: 'gbk' codec can't encode character '\xXX' in position XX

    从网上抓了一些字节流,想打印出来结果发生了一下错误: UnicodeEncodeError: 'gbk' codec can't encode character '\xbb' in position ...

  4. Python读取中文txt文件错误:UnicodeEncodeError: 'gbk' codec can't encode character

    with open(file,'r') as f: line=f.readline() i=1 while line: line=line.decode('utf-8') line=f.readlin ...

  5. web.py+mysql插入中文提示query = query.encode(charset) UnicodeEncodeError: 'latin-1' codec can't encode characters in position 86-100

    对于中文编码的问题,总会出现各种各样恶心的错误,还不知道应该怎么解决,首先,你从最开头就应该关注编码问题,尽量保证所有的编码方式都是一致的 用python+web.py+mysql来写程序,首先要保证 ...

  6. python 安装pip的时候出现UnicodeEncodeError错误

    另外 Python 中一个比较常见的问题是编码问题,若遇到类似"UnicodeEncodeError: 'ascii' codec can't encode character u'\u62 ...

  7. UnicodeEncodeError

    UnicodeEncodeError at /admin/shop/product/add/ 'ascii' codec can't encode characters in position 0-1 ...

  8. python:UnicodeEncodeError

    problem: (<type 'exceptions.UnicodeEncodeError'>, UnicodeEncodeError('ascii', u'[taobao_cocobe ...

  9. Python的Ftplib问题:UnicodeEncodeError: 'latin-1' codec can't encode characters的解决方法

    ftplib中有一个方法是cwd,用来切换目录,需要传入一个dirname,经过个人测试,该dirname不能含有汉字,会抛出:UnicodeEncodeError: 'latin-1' codec ...

随机推荐

  1. [转]PBFT 算法详解

    https://www.cnblogs.com/mafeng/p/8405375.html

  2. hdu1520 Anniversary party

    Anniversary party HDU - 1520 题意:你要举行一个晚会,所有人的关系可以构成一棵树,要求上下级关系的人不能同时出现,每一个人都有一个rating值,要求使整个晚会的ratin ...

  3. Java-GC-标记压缩算法

    标记压缩算法 其分为两个阶段标记阶段,和压缩阶段.其中标记阶段和标记清除算法的标记阶段是一样的. 对压缩算法来说,他的工作就是移动所有的可达对象到堆内存的同一区域中,使它们紧凑的排列在一起,从而将所有 ...

  4. js 检查字符串中是否包含中文(正则)

    function CheckChinese(val){ var reg = new RegExp("[\\u4E00-\\u9FFF]+","g"); if(r ...

  5. 长春理工大学第十四届程序设计竞赛(重现赛)J.Printout

    链接:https://ac.nowcoder.com/acm/contest/912/J 题意: 小r为了打校赛,他打算去打字社打印一份包含世界上所有算法的模板. 到了打字社,小r一看价格:总打印页数 ...

  6. A Simple Math Problem (矩阵快速幂)

    Lele now is thinking about a simple function f(x).  If x < 10 f(x) = x.  If x >= 10 f(x) = a0 ...

  7. Codeforces Round #431 (Div. 2) A

    Where do odds begin, and where do they end? Where does hope emerge, and will they ever break? Given ...

  8. Net Core 2.0生态1

    Net Core 2.0生态 阅读目录 前言:答读者问(time by:2017.8.19) 项目升级到ASP.NET Core 2.0 新增功能:Razor Pages介绍 模板更新 Entity ...

  9. CSS——制作天天生鲜主页

    终于做好了! index.html: <!DOCTYPE html> <html lang="en"> <head> <meta char ...

  10. 069 Sqrt(x) 求平方根

    实现 int sqrt(int x) 函数.计算并返回 x 的平方根.x 保证是一个非负整数.案例 1:输入: 4输出: 2案例 2:输入: 8输出: 2说明: 8 的平方根是 2.82842..., ...