Skip to main content
Solved

Running python subprocess.run in FME Form startup fails to find module boto3: ModuleNotFoundError


danielwebb
Contributor
Forum|alt.badge.img+2

I thought I had a good idea to simplify our in-house processes by using FME Form startup python script to use subprocess.run to run external python files. That way we wouldn’t need to copy all the python code into the startup script and could easily make changes to it.

Unfortunately, it doesn’t seem to work.

subprocess.run FME Form runs the python script, but errors with “ModuleNotFoundError: No module named ‘boto3’. The python script itself works fine when run manually. It also works when copied into the FME startup section (in other words, boto3 runs successfully in both).

But for some reason, running subprocess.run within FME Form will not find boto3 in the external python file (even though it works if the python code in is the startup script section of FME Form).

I hope that description made sense. Is there a parameter for subprocess.run that I’m missing? Is there another way to run an external python file from FME startup?

Software and Settings:

FME Form version 2023.2.3.0 (20240313 - Build 23783 - WIN64)
Python Compatibility set to Esri ArcGIS Python 3.7+
ArcGIS Pro version 3.1.6
boto3 version 1.21.32 (installed through ArcGIS Pro Package Manager)

Best answer by steveatsafe

To be clear, 

Ensure your Python Compatibility workspace parameter is set to “Esri*”. 

In the Startup Python Script parameter something like

# I have testmyPy.py located in c:/Steve/python)

import sys

sys.path.append (rf'C:/Steve/python/') # path to your script files

# importing the module will run the python script testmyPy.py

import testmyPy

import arcpy

 

View original
Did this help you find an answer to your question?

3 replies

steveatsafe
Safer
Forum|alt.badge.img+12

@danielwebb Likely will need to add all the paths to modules to the script file for this to work… 

sys.path.append

And even then, I have a question about which interpreter might be loading… So, you could do some preliminary testing to see what interpreter is loading/version… just to make sure and print out the paths that are in play. 

I’m not 100% sure, but the correct Python Interpreter paths may not be loading for the ArcGIS Python interpreter.  The Startup Script of FME workspace is running before the workspace starts to run (could it be not honouring Interpreter setting? Thus, it could be invoking the default interpreter of FME? 

I’ll have to come back to you on this suspicion, however.

 

There is a good discussion here (on a similar issue)… might give some clues or things to try.

 


steveatsafe
Safer
Forum|alt.badge.img+12

My colleague ​@debbiatsafe suggest an alternative to subprocess.run

 

Review this community post… it is on the Shutdown side but applicable to what you want to do.

 


steveatsafe
Safer
Forum|alt.badge.img+12
  • Safer
  • Best Answer
  • June 2, 2025

To be clear, 

Ensure your Python Compatibility workspace parameter is set to “Esri*”. 

In the Startup Python Script parameter something like

# I have testmyPy.py located in c:/Steve/python)

import sys

sys.path.append (rf'C:/Steve/python/') # path to your script files

# importing the module will run the python script testmyPy.py

import testmyPy

import arcpy

 


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings