Ymagis / ClairMeta

Clairmeta is a python package for Digital Cinema Package (DCP) probing and checking.
BSD 3-Clause "New" or "Revised" License
84 stars 22 forks source link

Problem running the command in console app on Linux #249

Open petervanvogelpoel-filmbooking opened 3 weeks ago

petervanvogelpoel-filmbooking commented 3 weeks ago

Hi,

When I run the following manually on Linux I have no problem:

python3 -m clairmeta.cli probe -type dcp /media/dcpstorage/f069c7d8-1e5e-4e73-8558-08dcf50b3609/MY_DCP_VF -format json > /media/dcpstorage/f069c7d8-1e5e-4e73-8558-08dcf50b3609/probe.json

When I try the same in my console app I get an error. My code:

        string pathtodcp = "/media/dcpstorage/f069c7d8-1e5e-4e73-8558-08dcf50b3609/MY_DCP_VF";
        string pathtoreport = "/media/dcpstorage/f069c7d8-1e5e-4e73-8558-08dcf50b3609/";

        string command = "python3";
        string commandarguments = " -m clairmeta.cli probe -type dcp " + pathtodcp + " -format json > " + pathtoreport + "probe.json";

        process = new();
        process.EnableRaisingEvents = true;
        process.OutputDataReceived += new DataReceivedEventHandler(process_OutputDataReceived);
        process.ErrorDataReceived += new DataReceivedEventHandler(process_ErrorDataReceived);
        process.Exited += new EventHandler(process_Exited);

        process.StartInfo.FileName = command;
        process.StartInfo.Arguments = commandarguments;
        process.StartInfo.UseShellExecute = false;
        process.StartInfo.RedirectStandardError = true;
        process.StartInfo.RedirectStandardOutput = true;

        process.Start();
        process.BeginErrorReadLine();
        process.BeginOutputReadLine();
        process.WaitForExit();

The error is:

usage: cli.py [-h] {check,probe} ... cli.py: error: unrecognized arguments: > /media/dcpstorage/f069c7d8-1e5e-4e73-8558-08dcf50b3609/probe.json

Can somebody help?

remia commented 3 weeks ago

Hi @petervanvogelpoel-filmbooking,

Not familiar with the Console app code you are sharing but my guess would be to remove the part redirecting the command output to a file (> ...json) and instead use your process object to query the command output and write it to a file if you need to.

petervanvogelpoel-filmbooking commented 3 weeks ago

Hi Remia, Thanks for getting back on this. In the meantime I did exactly what you are suggesting and that worked. Thanks again.

remia commented 3 weeks ago

Glad to hear that!