3

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!

1

These settings configuration fixed the issue:

fme.exe APPLY_SETTINGS SYSTEM "Python/Use Custom Python" true
fme.exe APPLY_SETTINGS SYSTEM "Python/Python Interpreter" c:/windows/SysWOW64/python27.dll

I just had to restart the server after i applied the changes. This will just force FME to use ArcGIS' Phyton Interpreter which carries the arcgisscripting.

1

The other way to get FME to use a different interpreter is under Tools > Options > Runtime in the Workbench menu:

enter image description here

  • 1
    Thanks Mark, I actually did that too but it only seems to save the settings on the specific user that changed it(I might have missed a step). That's why I was encountering the issue because i was executing the batch file remotely. – Juno Aug 21 '14 at 15:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.