Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/templates/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 为什么会出现这个错误?SyntaxError:无效语法_Python_Xml_Pyxb - Fatal编程技术网

Python 为什么会出现这个错误?SyntaxError:无效语法

Python 为什么会出现这个错误?SyntaxError:无效语法,python,xml,pyxb,Python,Xml,Pyxb,我试图使用python验证一些XML文件,但在尝试将模式转换为py文件时,我已经遇到了一个错误 到目前为止,我的两行代码: import pyxb pyxbgen -u /Users/xyz/XML_Validation/schemas/schema_short.xsd -m schema_short 我得到的错误是“SyntaxError:invalid syntax”,在末尾突出显示“schema_short” 为什么会出现这个错误?我已经将我的代码与在线示例进行了比较,但我看不出我做错

我试图使用python验证一些XML文件,但在尝试将模式转换为py文件时,我已经遇到了一个错误

到目前为止,我的两行代码:

import pyxb

pyxbgen -u /Users/xyz/XML_Validation/schemas/schema_short.xsd -m schema_short
我得到的错误是“SyntaxError:invalid syntax”,在末尾突出显示“schema_short”

为什么会出现这个错误?我已经将我的代码与在线示例进行了比较,但我看不出我做错了什么

谢谢

Python/IDLE版本2.7.6
Pyxb 1.2.3版

看起来您在混合语法
pyxbgen-u/Users/xyz/XML\u Validation/schemas/schema\u short.xsd-m schema\u short
不是有效的python,它看起来像是命令行调用。

不能在空闲状态下运行第二行--它具有无效的python语法

它应该通过命令行运行:

$ pyxbgen -u /Users/xyz/XML_Validation/schemas/schema_short.xsd -m schema_short
是一个Python IDE。也就是说,它只接受有效的Python代码