python-rrdtool创建rrd文件的TypeError: argument 0 must be string 错误
来源:互联网 发布:java装饰者设计模式 编辑:程序博客网 时间:2024/05/22 06:15
在使用python-rrdtool进行rrd的创建时
产生
TypeError: argument 0 must be string
的错误
始终搞不明白是为什么,每个参数都已经检查了是字符串
但是总是出这个错误
后来在rrdtool的forum上偶尔看到,参数不可以是unicode
才想起来,我的参数确实是unicode的
解决方法很简单,使用参数时,encode一下即可。
注:python中
>>> type(u'server')
<type 'unicode'>
>>> type('server')
<type 'str'>
>>> u'server' == 'server'
True
>>> u'中文' == '中文'
__main__:1: UnicodeWarning: Unicode equal comparison failed to convert both arguments to Unicode - interpreting them as being unequal
False
- python-rrdtool创建rrd文件的TypeError: argument 0 must be string 错误
- Python 读写文件 中文乱码 错误TypeError: write() argument must be str, not bytes+
- Python 读写文件 错误TypeError: write() argument must be str, not bytes+
- python错误:TypeError: string indices must be integers
- Python出现TypeError: file() argument 1 must be encoded string without NULL bytes, not str问题解决
- python提示错误TypeError: write() argument must be str, not bytes
- TypeError: argument 1 must be string or buffer, not instance
- python-TypeError: write() argument must be str, not numpy.float64
- python:PyInstaller打包发布单个文件错误struct.error: argument for 's' must be a string解决
- React 使用fromidable 模块进行文件上传出现First argument must be a string 的解析错误的原因
- TypeError:First argument must be file descriptor
- Python TypeError: must be string or buffer, not dict
- 学习node时报错throw new TypeError('first argument must be a string or Buffer');
- Python错误:AssertionError: group argument must be None for now
- TypeError: write() argument must be str, not bytes
- NodeJs TypeError: First argument must be file descriptor解决方法
- docx2txt TypeError: write() argument must be str, not bytes
- Argument must be non-nil 断言错误
- zlib用法简单说明
- 关于三大框架(转)
- mysql中insert into select from的使用
- sicily 1791
- 初始化列表
- python-rrdtool创建rrd文件的TypeError: argument 0 must be string 错误
- 动态模型及其求解介绍—番外篇(转帖)
- Dev GridControl 和chartControl、SplitterControl 简单操作
- VC6.0
- LogicJava---Lesson5
- ERP/Oracle - PL/SQL 编程日记
- 动态模型及其求解介绍—上(转帖)
- 流体动力学软件
- 机器学习概念整理