Encountered another roadblock. I have a working FME script that I want to automatically run using a console app.
I created a simple batch file which accepts a MDB file path as parameter:
fme.exe E:\sample.fmw --SourceDataset_GEODATABASE_MDB "%1"
when I run this batch file, everything works well.
But when I try to do the same thing only in my console application using the following code:
processInfo = New ProcessStartInfo("cmd.exe", "/c C:\executeFME.bat C:\sampleFile.mdb")
processInfo.CreateNoWindow = True
processInfo.UseShellExecute = False
processInfo.RedirectStandardError = True
processInfo.RedirectStandardOutput = True
process__1 = Process.Start(processInfo)
process__1.WaitForExit()
Dim output As String = process__1.StandardOutput.ReadToEnd()
Dim [error] As String = process__1.StandardError.ReadToEnd()
Dim exitCode = process__1.ExitCode
Console.WriteLine("ExitCode: " & exitCode.ToString(), "ExecuteCommand"
process__1.Close()
I get the error "Python Exception : No module named arcgisscripting"
I have a Startup python script that will check the geometries of the supplied mdb file and this is where it errors out.
Do I still need to configure something to make it to work?
Thanks.
EDIT
I noticed in the log files that the manually executed batch file using the correct Python Interpreter: C:\Windows\SysWOW64\python27.dll while the batch file executed by the console app uses a different one: C:\apps\FME\fmepython27\python27.dll. I tried modifying the Interpreter settings by using:
fme.exe APPLY_SETTINGS SYSTEM "Python/Python Interpreter" c:/windows/SysWOW64/python27.dll
Ran it again and it was still using the old interpreter. I think this is the cause of this but I'm out of ideas on how to fix it. Please help!