Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem running the command in console app on Linux #249

Open
petervanvogelpoel-filmbooking opened this issue Oct 25, 2024 · 3 comments
Open

Comments

@petervanvogelpoel-filmbooking
Copy link

petervanvogelpoel-filmbooking commented Oct 25, 2024

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
Copy link
Collaborator

remia commented Oct 26, 2024

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
Copy link
Author

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

@remia
Copy link
Collaborator

remia commented Oct 26, 2024

Glad to hear that!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants