首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >dicttoxml抛出AttributeError

dicttoxml抛出AttributeError
EN

Stack Overflow用户
提问于 2019-06-15 07:08:15
回答 1查看 41关注 0票数 1

我试着检查dicttoxml是如何工作的。但是我在dicttoxml模块中收到了这个错误。我正在从geany启动程序。有人能帮上忙吗?谢谢!

代码语言:javascript
复制
import dicttoxml

myDict = {'myKey':"theirValue"};

xml =dicttoxml.dicttoxml(myDict);

输出为:

代码语言:javascript
复制
martin@saturn:~/it/python/python_work$ /bin/sh /tmp/geany_run_script_Q2NH3Z.sh
0.32000000000000006
1.6666666666666667
['1', '6666666666666667']

Traceback (most recent call last):
  File "dicttoxmlExmp.py", line 4, in <module>
    xml =dicttoxml.dicttoxml(myDict);
  File "/home/martin/.local/lib/python3.6/site-packages/dicttoxml.py", line 393, in dicttoxml
    convert(obj, ids, attr_type, item_func, cdata, parent=custom_root), 
  File "/home/martin/.local/lib/python3.6/site-packages/dicttoxml.py", line 176, in convert
    if isinstance(obj, numbers.Number) or type(obj) in (str, unicode):
AttributeError: module 'numbers' has no attribute 'Number'
EN

回答 1

Stack Overflow用户

发布于 2019-06-17 01:41:33

您可以简单地这样做:

python你的脚本

而不是将其作为shell脚本运行。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/56606034

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档