load_dotenv doesn't find .env when run from LabVIEW
Los mantenedores suelen responder en 12 días
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 45/100
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.)
- Lenguaje dominante
- Python
- Estrellas
- 8.9k
- Forks
- 618
- Merge medio
- 12 d 6 min
- PR fusionados (30 d)
- 3
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de theskumar/python-dotenv
-
Variable declared without a value suppresses ${VAR:-default} expansionPosiblemente ocupada @Omarinho12345 la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
theskumar/python-dotenv#750 ·
Los mantenedores suelen responder en 12 días
-
An empty value ignores ${name:-default}Posiblemente ocupada @SashaMIT la tomó hace 41 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
theskumar/python-dotenv#715 ·
Los mantenedores suelen responder en 12 días
-
set_key and unset_key don't fsync before replacing the .env filePosiblemente ocupada @Imkkey la tomó hace 40 días. Abiertoenhancement
Dificultad 3/5 1-2 días Aptitud para principiantes 72/100
theskumar/python-dotenv#713 ·
Los mantenedores suelen responder en 12 días
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 28/100
theskumar/python-dotenv#693 · 1 comentario ·
Los mantenedores suelen responder en 12 días
-
python-dotenv installation without cli masks python-dotenv cliPosiblemente ocupada @gyanu2507 la tomó hace 80 días. Abierto
Dificultad 3/5 1-2 días Aptitud para principiantes 55/100
theskumar/python-dotenv#683 · 4 comentarios ·
Los mantenedores suelen responder en 12 días
Todos los issues de theskumar/python-dotenv
Issues similares
-
release
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
MichaelYcJo/SpecSeal#1535 ·
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
valentinfrlch/ha-llmvision#769 ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 1/5 Menos de una hora Aptitud para principiantes 75/100
daniel-ospina/tortoise#11937 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
good first issue help wanted python up-for-grabs
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
andrewsiah/agentswarm-data-tasks#238 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
cadence-workflow/cadence-ai-samples#175 ·
Los mantenedores suelen responder en 1 día