Question

I'm trying to validate some XML-Files using python, but I am already getting an error when I try to convert the schema to a py-file.

My two lines of code so far:

import pyxb

pyxbgen -u /Users/xyz/XML_Validation/schemas/schema_short.xsd -m schema_short

The Error i get is "SyntaxError: invalid syntax", highlighting "schema_short" at the end.

Why do I get this Error? I've compared my code to examples online, but I don't see what I'm doing wrong here.

Thanks!

Python/IDLE Version 2.7.6 Pyxb Version 1.2.3

Was it helpful?

Solution

It looks like you are mixing syntax. pyxbgen -u /Users/xyz/XML_Validation/schemas/schema_short.xsd -m schema_short is not valid python, it looks like a command line call.

OTHER TIPS

You can't run that second line in IDLE--it has invalid Python syntax.

It should be run through the command line:

$ pyxbgen -u /Users/xyz/XML_Validation/schemas/schema_short.xsd -m schema_short

IDLE is a Python IDE. Meaning, it only accepts valid Python code.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top