Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

errorI'm trying to run a second workspace using python command in "Shutdown Python Script" in the first workspace using the following command. But its giving me an error. Is there anything I need to do different? I am using FME 2012 SP 2

Thanks, Sam

So as suggested by Safe tech support, I created a batch file with the following code:

fme.exe c:\test2.fmw --SourceDataset_ARCGIS_LAYER C:\ScratchParcel\DevEnv.gdb\AddressPoint --DestDataset_SHAPE C:\temp

and added the following code in the shutdown python script window:

import os os.system("C:\\temp\\test.bat")

When I run it, although it says transaction was successful, I don't get any results i.e., the output shapefile is not created.

share|improve this question
    
Is there a test2.log in the same folder as test2.fmw? If that's being created when you run the batch file then it's running properly and the workspace itself isn't working correctly. –  blah238 Jun 20 '12 at 20:41
    
There is no log file being created. So does this mean there is something wrong with the code? –  Sam Jun 20 '12 at 20:48
    
Does it work if you run the batch file directly? Run it from a command window or add a pause statement so it doesn't disappear before you can see what it says. –  blah238 Jun 20 '12 at 22:32
    
I added pause statement to the batch file and there was a tanslation failed message. I uploaded the screen shot of it but it disappeared. Is there any other way to upload the image? –  Sam Jun 21 '12 at 13:05
    
Assuming you can run the test2.fmw workspace in workbench, try deleting the --Source/DestDataset params and simply running 'fme.exe c:\test2.fmw'. –  Raven Jun 21 '12 at 16:32

2 Answers 2

up vote 4 down vote accepted

Your Python doesn't look syntactically valid. Try

import os
os.system("fme.exe C:\\temp\\test2.fmw --SourceDataset_ARCGIS_LAYER C:\\ScratchParcel\\DevEnv.gdb\\AddressPoint --DestDataset_SHAPE C:\\temp")

I've added the parens and quotes around the string you are passing to os.system, and escaped the backslashes.

Update: In addition, the fme.exe in your path is different than the fme.exe being run by Workbench. Explicitly specify the path to the fme.exe you want to run:

os.system("c:\\pathToFme\\fme.exe test2.fmw")

or, perhaps in this more future proof manner

os.system(os.path.join(os.environ['FME_HOME'], "fme.exe") + " test2.fmw")

which says "run using the fme.exe that we are currently running".

share|improve this answer
    
Raven, I am still getting error with the python execution. –  Sam Jun 20 '12 at 17:39
    
What error do you get? Is it a Python error or an FME error? –  Raven Jun 20 '12 at 19:25
    
The logfile says its successful but I dont see any results. "FME_END_PYTHON: evaluating python script from string... FME_END_PYTHON: python script execution complete." –  Sam Jun 20 '12 at 20:10
    
There should be a log file left over from the fme.exe execution invoked by your end Python. You can override the log location in the test2.fmw sub-workspace if you are having trouble finding it. (Can be done via command line too, but I can't remember how offhand.) –  Raven Jun 20 '12 at 22:52
    
Thank you Raven. It worked!! –  Sam Jun 27 '12 at 13:45

FME start up and shutdown scripts (FME, Python and Oracle)

only screenshots of the startup/shutdown process so you will have to create your own.

enter image description here

The whole process is a multi-stage system, requiring the use of FME startup and shutdown scripts.

http://fmepedia.safe.com/articles/Samples_and_Demos/Example-Workflow-using-FME-Python-and-Oracle

share|improve this answer
    
fmepedia.safe.com/articles/How_To/… has editable scripts in the sample-workspaces.zip –  Mapperz Jun 19 '12 at 17:04

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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