I have a piece of cocoa code that I wrote in which there is an XML file that contains the bounding boxes, which After that there is a video (each box has an associated frame) the cocoa program is run from the command line (and takes all its parameters as a command line argument)
I will not allow any XML document However, when I can run fine with If I try to run the program in a Python script, then I have problems. For example:
file ("test.xml") as temp: temp.write (doc .toprettyxml ()) #cval is my coca program to call, other arguments are given by python scripts and opters command = ["./cval", "-o", options.output, "-i", str ( Options.interval, parsed with "-s", "% dx% d"% sometimes it will be desired), "-f", str (options.frames), "-x", temp. Name] subprocess.call (command) my 'crawl' fails The region will not be another time (to change a number of XML documents can change his behavior) I can also confirm to try to read an XML element to break it which is not there. Only, I can open 'test.xml', and actually confirm the existing element.
However, if I run 'test.xml' myself ('outside the python script' '), it works great. It leads me to believe that when I 'subprosy Call ', then something strange is happening, but I'm not sure what this can be. I have other cocoa / python that do completely different functions (i.e. not using xml) which display arbitrarily strange behavior, but are more complex in nature.
I was hoping someone could know the next step in this problem well, or debugging this weirdness.
Because code basically used temporary files, I close the file before passing it in the subprocess. could not do. However, what I should have done, instead of placing a subprocess call, flush the file. Automated flushing is being done on the automatic threshold with size size as a result of the possibility of incompatible behavior.
The code should be read:
with file ("test.xml") in temporarily: temp.write (doc.toprettyxml ()) temp.flush ( ) Command = ["./cval", "-o", options.output, "-i", str (options.interval), "-s", "% dx% d"% (options.width, options. Height), "-f", str (options.frames), "-x", temp.name] subprocess.call (command)
Comments
Post a Comment