load_dotenv doesn't find .env when run from LabVIEW
Les mainteneurs répondent en général sous 12 jours
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Accessibilité débutants
- 45/100
Piste de recherche
Start with find_dotenv, especially its _is_interactive function, and compare its behavior when the Python script is run normally versus inside LabVIEW. Done means the .env file beside the script is found without passing an explicit path, while the existing load_dotenv and find_dotenv behavior remains intact.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
I have a Python script that I'm running from LabVIEW using a Python node (LabVIEW's mechanism for running Python scripts inside a LabVIEW program).
I have .env file in the same directory with the Python script. However, when running the script from LabVIEW, load_dotenv() doesn't find .env, and neither does find_dotenv().
The culprit seems to be _is_interactive function inside find_dotenv:
def _is_interactive():
""" Decide whether this is running in a REPL or IPython notebook """
main = __import__('__main__', None, None, fromlist=['__file__'])
return not hasattr(main, '__file__')
When Python script is run inside LabVIEW, __name__ is set to the name of the Python module that is run, instead of __main__. Therefore, although __file__ is available and set properly when the script is run, and the script is actually not being run interactively, the above function returns true.
Consequently, .env is not searched for in the directory in which the script is located, but instead in the working directory, which in case of LabVIEW is C:\Windows\System32, and therefore cannot be found.
(I can work around the problem by passing the correct path manually to load_dotenv, but it would be great to have dotenv find the path automatically.)
- Langage dominant
- Python
- Étoiles
- 8.9k
- Forks
- 618
- Merge moyen
- 12 j 6 min
- PR mergées (30 j)
- 3
Préparer son environnement
- Aucun Dockerfile ni fichier Docker Compose
- Aucun modèle de pull request
- Lire 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
-
Variable declared without a value suppresses ${VAR:-default} expansionPeut-être pris @Omarinho12345 l’a pris aujourd’hui. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 85/100
theskumar/python-dotenv#750 ·
Les mainteneurs répondent en général sous 12 jours
-
An empty value ignores ${name:-default}Peut-être pris @SashaMIT l’a pris il y a 41 jours. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100
theskumar/python-dotenv#715 ·
Les mainteneurs répondent en général sous 12 jours
-
set_key and unset_key don't fsync before replacing the .env filePeut-être pris @Imkkey l’a pris il y a 40 jours. Ouverteenhancement
Difficulté 3/5 1-2 jours Accessibilité débutants 72/100
theskumar/python-dotenv#713 ·
Les mainteneurs répondent en général sous 12 jours
-
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 28/100
theskumar/python-dotenv#693 · 1 commentaire ·
Les mainteneurs répondent en général sous 12 jours
-
python-dotenv installation without cli masks python-dotenv cliPeut-être pris @gyanu2507 l’a pris il y a 80 jours. Ouverte
Difficulté 3/5 1-2 jours Accessibilité débutants 55/100
theskumar/python-dotenv#683 · 4 commentaires ·
Les mainteneurs répondent en général sous 12 jours
Toutes les issues de theskumar/python-dotenv
Issues similaires
-
release
Difficulté 2/5 1-3 heures Accessibilité débutants 76/100
MichaelYcJo/SpecSeal#1535 ·
-
bug
Difficulté 2/5 1-3 heures Accessibilité débutants 82/100
valentinfrlch/ha-llmvision#769 ·
Les mainteneurs répondent en général sous 1 jour
-
bug
Difficulté 1/5 Moins d'une heure Accessibilité débutants 75/100
daniel-ospina/tortoise#11937 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
good first issue help wanted python up-for-grabs
Difficulté 2/5 1-3 heures Accessibilité débutants 82/100
andrewsiah/agentswarm-data-tasks#238 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 70/100
cadence-workflow/cadence-ai-samples#175 ·
Les mainteneurs répondent en général sous 1 jour