Open funatsufumiya opened 2 years ago
Same problem here, since last week
[EDIT] Quick workaround if applicapable: Switch to function runtime version ~3
Also recently began running into No module named '__main__' errors
in previously functional HTTP Trigger Python Azure Functions, specifically when calling functions in __init__.py
imported from another location:
Scrubbed example:
from src import file1
...
file1.func1(arg1, arg2)
file1
imports fine, then when func1
is called receive the error:
ModuleNotFoundError: No module named '__main__'
Per @afjankahnt was able to work around by setting Function Runtime Version from ~4
to ~3
-- now works successfully (as before)
Same problem here, since last week
[EDIT] Quick workaround if applicapable: Switch to function runtime version ~3
Thank you @afjankahnt , your solution worked for me worked for me.
In case someone wants to avoid 1 google search I am pinning how to switch runtime version:
Support for runtime ~3 is going to end by Dec 2022. Its not far away, this issue would be good to be fixed.
https://docs.microsoft.com/en-us/azure/azure-functions/functions-versions?tabs=azure-cli%2Cin-process%2Cv4&pivots=programming-language-python (important note at the top mentions support end).
looks like the issue is probably on azure's side, and they're working on it: https://github.com/Azure/azure-functions-python-worker/issues/1094
dotenv.load_dotenv()
causedModuleNotFoundError: No module named '__main__'
on the latest Azure Functions Python 3.9 environment (used as HTTP Trigger).This is happening when use
find_dotenv()
internally, so this can be fixed by specifying env path like below.(Issue #299 is maybe similar.)
Error logs: