Home > Net >  Ask questions about the process
Ask questions about the process

Time:05-24

When I use a process called python. An.exe python scripts, if print contains Chinese, python scripts using StandardOutput reading error when the return value
The code is as follows: the path is script address
 
Public string test (string path)
{
String a="";
Try
{
The Process of p=new Process ();
P. tartInfo. FileName=System. The AppDomain. CurrentDomain. BaseDirectory + "/Python27/ArcGIS10.6/python. Exe";
String sArguments=path;//python file
SArguments +="valid_q";//the arguments required by the python file
P. tartInfo. The Arguments=sArguments;
P. tartInfo. UseShellExecute=false;
P. tartInfo. RedirectStandardOutput=true;
P. tartInfo. RedirectStandardInput=true;
P. tartInfo. RedirectStandardError=true;
P. tart ();
A=p. tandardOutput. ReadToEnd ();
P.W aitForExit ();
}
The catch (Exception e) {return e. oString (); }
return a;
}

Error figure
  • Related