AnsweredAssumed Answered

MultipleRingBuffer_analysis

Question asked by Azghar on Mar 31, 2020

Please help me with MultipleRingBuffer_analysis. 

My applications needs to call arcpy python script that call MultipleRingBuffer_analysis from C# code.

 

 

I am calling this python script file from C# code like this

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication1
{
using System.Diagnostics;

class Program
{
static void Main(string[] args)
{
string refresult = string.Empty;
string tmpfileName1 = "C:\\inetpub\\wwwroot\\PyScript\\MultiEvent.py 20:30:40 FLOOD_JKT_2013BUFF p123245";
int ExitCode = -1;
Random rn = new Random();
int Order = rn.Next(10000000, 99999999);
string message = string.Empty;
message = "";
message += "Running run_cmdforAllA \n";
string strmsg = string.Empty;



message += "create a process object \n";
Process p = new Process();
message += " after creating process object \n";


string fileName1 = tmpfileName1;
message += "Process info \n";
//logfile.WriteLine(@"ProcessStartInfo is :C:\Python27\ArcGIS10.6\python.exe and " );
//logfile.Flush();
p.StartInfo = new ProcessStartInfo(@"C:\Python27\ArcGIS10.7\python.exe", fileName1)
{

RedirectStandardOutput = true,
UseShellExecute = false,
CreateNoWindow = true,
RedirectStandardError = true

};


message += "process before start \n";
p.Start();
message += "process after start \n";
p.StartInfo.Verb = "runas";
// message += "process before WaitForExit \n";

p.WaitForExit();
ExitCode = p.ExitCode;
message += "process after WaitForExit \n";

p.WaitForExit();

//Check to see if the process is still running.
if (p.HasExited == false)
{
message += "Enter if part \n";
message += "Process is still running \n";
//Process is still running.
//Test to see if the process is hung up.
if (p.Responding)
{
message += "Process was not responding; close the main window. \n";
//Process was responding; close the main window.
p.CloseMainWindow();
}
else
{

//Process was not responding; force the process to close.
message += "Process was not responding; force the process to close. \n";
//Process was not responding; force the process to close.
p.Kill();
message += "After killing the process \n";

}

}

message += "before standard output. \n";
string output = p.StandardOutput.ReadToEnd();

message += " standard output ==> " + output + " \n";
message += "after standard output. \n";

message += "Standard Error ====> " + p.StandardError.ReadToEnd() + "\n";

 


strmsg = output;

}
//static void OpenMicrosoftWord(string file)
//{
// ProcessStartInfo startInfo = new ProcessStartInfo();
// startInfo.FileName = "python";
// startInfo.Arguments = "C:\\inetpub\\wwwroot\\PyScript\\MultiEvent.py 20:30:40 FLOOD_JKT_2013BUFF p123245";
// Process.Start(startInfo);
// Process.Wai

//}


}
}

 

This code works properly when buffer size is single digit 1:2:3 but when I increase to double digit then 10:20:30 it fails with following error.

ERROR 999999: Error executing function.
An error occurred during the buffer operation
Failed to execute (Buffer).

Failed to execute (MultipleRingBuffer).

Outcomes