ModuleNotFoundError: No module named '__main__' / load_dotenv() error on the latest Azure Functions (Python 3.9, Linux)
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Accessibilité débutants
- 35/100
Piste de recherche
Start with the find_dotenv() and load_dotenv() entry points shown in dotenv/main.py, then reproduce the failure in the Azure Functions Python 3.9 environment described. Verify that loading the environment file no longer raises ModuleNotFoundError for main, while the existing path-discovery behavior remains usable.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
dotenv.load_dotenv() caused ModuleNotFoundError: 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.
envpath = os.path.join(os.path.dirname(__file__), '.env')
dotenv.load_dotenv(envpath)
(Issue #299 is maybe similar.)
Error logs:
Result: Failure Exception: ModuleNotFoundError: No module named '__main__' Stack: File "/azure-functions-host/workers/python/3.9/LINUX/X64/azure_functions_worker/dispatcher.py", line 448, in _handle__invocation_request call_result = await self._loop.run_in_executor( File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) File "/azure-functions-host/workers/python/3.9/LINUX/X64/azure_functions_worker/dispatcher.py", line 691, in _run_sync_func return ExtensionManager.get_sync_invocation_wrapper(context, File "/azure-functions-host/workers/python/3.9/LINUX/X64/azure_functions_worker/extension.py", line 215, in _raw_invocation_wrapper result = function(**args) File "/home/site/wwwroot/HttpTrigger_jetson_01_test/__init__.py", line 43, in main container_client = adls.get_container_client(place_name) File "/home/site/wwwroot/adls.py", line 14, in get_container_client dotenv.load_dotenv() File "/home/site/wwwroot/.python_packages/lib/site-packages/dotenv/main.py", line 322, in load_dotenv dotenv_path = find_dotenv() File "/home/site/wwwroot/.python_packages/lib/site-packages/dotenv/main.py", line 275, in find_dotenv if usecwd or _is_interactive() or getattr(sys, 'frozen', False): File "/home/site/wwwroot/.python_packages/lib/site-packages/dotenv/main.py", line 272, in _is_interactive main = __import__('__main__', None, None, fromlist=['__file__'])
- Langage dominant
- Python
- Étoiles
- 8.9k
- Forks
- 581
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de theskumar/python-dotenv
-
Difficulté 2/5 1-3 heures Accessibilité débutants 88/100
theskumar/python-dotenv#699 · 1 commentaire ·
-
Difficulté 2/5 1-3 heures Accessibilité débutants 35/100
theskumar/python-dotenv#697 ·
-
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 28/100
theskumar/python-dotenv#693 · 1 commentaire ·
-
Difficulté 3/5 1-2 jours Accessibilité débutants 55/100
theskumar/python-dotenv#683 · 4 commentaires ·
-
Difficulté 3/5 1-2 jours Accessibilité débutants 55/100
theskumar/python-dotenv#644 · 2 commentaires ·
Toutes les issues de theskumar/python-dotenv
Issues similaires
-
area/auth bug comp/agent P3 platform/discord type/security
Difficulté 2/5 1-3 heures Accessibilité débutants 88/100
NousResearch/hermes-agent#117848 ·
-
Difficulté 2/5 1-3 heures Accessibilité débutants 74/100
bancolombia/sentinel#23 ·
-
test md OuverteCI
Difficulté 2/5 1-3 heures Accessibilité débutants 74/100
-
integration:quickjs org:external priority:backlog topic:code-interpreter topic:middleware type:feature
Difficulté 2/5 1-3 heures Accessibilité débutants 74/100
langchain-ai/deepagents#6450 ·
-
bug client
Difficulté 2/5 1-3 heures Accessibilité débutants 88/100