Importing the FME modules seems to work and I'm using the same interpreter as with the WorkspaceRunner.py sample. "testWorkSpace.fmw" is an empty workspace.
I also found that when executing WorkspaceRunner.py without going through fme.exe i get the following error:
FMEWorkspaceRunner: Errorin dialog creation during initialization
Are you able to provide more information on the Python environment you're using when running into this error? For example, what version of FME and the Python interpreter is used?
I was able to reproduce the error you're seeing when using the fmeobjects.FMEWorkspaceRunner() class with python.org's Python 3.8 and 3.9 interpreters. It appears to be resolved if the FME install directory is inserted into the PATH environment variable in addition to using os.add_dll_directory(). The dialog error may be related to QT and should be resolved by setting the environment variable QT_QPA_PLATFORM_PLUGIN_PATH.
For example, the script below completes successfully with FME 2022 and Python 3.9.
import os
import sys
os.add_dll_directory(r"C:\Program Files\FME")
os.environ['PATH']=r"C:\Program Files\FME;"+ os.environ['PATH']
sys.path.append(r"C:\Program Files\FME\fmeobjects\python39")
## Set QT_QPA_PLATFORM_PLUGIN_PATH environment variable if encountering error about QT or dialogs
os.environ['QT_QPA_PLATFORM_PLUGIN_PATH']=r"C:\Program Files\FME\qtplugins\platforms"import fmeobjects
runner = fmeobjects.FMEWorkspaceRunner()
workspace = "testWorkSpace.fmw"
runner.promptRun(workspace)
Are you still encountering errors after running the modified script?
Hi, can you try adding a Creator transformer in your empty workspace and see if that makes a difference. Running an empty workspace could very well be the issue.
Hi, can you try adding a Creator transformer in your empty workspace and see if that makes a difference. Running an empty workspace could very well be the issue.
Are you able to provide more information on the Python environment you're using when running into this error? For example, what version of FME and the Python interpreter is used?
Are you able to provide more information on the Python environment you're using when running into this error? For example, what version of FME and the Python interpreter is used?
I was able to reproduce the error you're seeing when using the fmeobjects.FMEWorkspaceRunner() class with python.org's Python 3.8 and 3.9 interpreters. It appears to be resolved if the FME install directory is inserted into the PATH environment variable in addition to using os.add_dll_directory(). The dialog error may be related to QT and should be resolved by setting the environment variable QT_QPA_PLATFORM_PLUGIN_PATH.
For example, the script below completes successfully with FME 2022 and Python 3.9.
import os
import sys
os.add_dll_directory(r"C:\Program Files\FME")
os.environ['PATH']=r"C:\Program Files\FME;"+ os.environ['PATH']
sys.path.append(r"C:\Program Files\FME\fmeobjects\python39")
## Set QT_QPA_PLATFORM_PLUGIN_PATH environment variable if encountering error about QT or dialogs
os.environ['QT_QPA_PLATFORM_PLUGIN_PATH']=r"C:\Program Files\FME\qtplugins\platforms"import fmeobjects
runner = fmeobjects.FMEWorkspaceRunner()
workspace = "testWorkSpace.fmw"
runner.promptRun(workspace)
Are you still encountering errors after running the modified script?
I was able to reproduce the error you're seeing when using the fmeobjects.FMEWorkspaceRunner() class with python.org's Python 3.8 and 3.9 interpreters. It appears to be resolved if the FME install directory is inserted into the PATH environment variable in addition to using os.add_dll_directory(). The dialog error may be related to QT and should be resolved by setting the environment variable QT_QPA_PLATFORM_PLUGIN_PATH.
For example, the script below completes successfully with FME 2022 and Python 3.9.
import os
import sys
os.add_dll_directory(r"C:\Program Files\FME")
os.environ['PATH']=r"C:\Program Files\FME;"+ os.environ['PATH']
sys.path.append(r"C:\Program Files\FME\fmeobjects\python39")
## Set QT_QPA_PLATFORM_PLUGIN_PATH environment variable if encountering error about QT or dialogs
os.environ['QT_QPA_PLATFORM_PLUGIN_PATH']=r"C:\Program Files\FME\qtplugins\platforms"import fmeobjects
runner = fmeobjects.FMEWorkspaceRunner()
workspace = "testWorkSpace.fmw"
runner.promptRun(workspace)
Are you still encountering errors after running the modified script?
This worked but I had to set the full path to the workspace as well.
We use 3 different kinds of cookies. You can choose which cookies you want to accept. We need basic cookies to make this site work, therefore these are the minimum you can select. Learn more about our cookies.