run Metashape with "-r " mode , with arg " > c:\log.txt " ,in my c# program, can't output logFile
this is the main code ,it can't build c:\log.txt automatically.
but is is in the windows cmd ,it can build c:\log.txt automatically.
private void RunPythonScript()
{
try
{
process.StartInfo.FileName = @"C:\PhotoScanPro\photoscan.exe";
string sArguments = string.Empty;
sArguments += @"C:\PhotoScanPro\photoscan.exe -r C:\PhotoScanPro\modules\test.py > C:\log.txt";
process.StartInfo.Arguments = sArguments;
process.StartInfo.UseShellExecute = false;
process.StartInfo.RedirectStandardOutput = true;
process.StartInfo.RedirectStandardInput = true;
process.StartInfo.RedirectStandardError = true;
process.StartInfo.CreateNoWindow = true;
process.Start();
process.BeginOutputReadLine();
process.OutputDataReceived += new DataReceivedEventHandler(ExeOutputDataReceived);
}
catch (Exception ex)
{
}
}
the attachment file is my c# project and text python.