load_dotenv doesn't find .env when run from LabVIEW
Maintainer thường phản hồi trong vòng 12 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 45/100
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.)
- Ngôn ngữ chính
- Python
- Star
- 8.9k
- Fork
- 618
- Merge trung bình
- 12 ngày 6 phút
- Pull request đã merge (30 ngày)
- 3
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của theskumar/python-dotenv
-
Variable declared without a value suppresses ${VAR:-default} expansionCó thể đã có người làm @Omarinho12345 đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
theskumar/python-dotenv#750 ·
Maintainer thường phản hồi trong vòng 12 ngày
-
An empty value ignores ${name:-default}Có thể đã có người làm @SashaMIT đã nhận 41 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
theskumar/python-dotenv#715 ·
Maintainer thường phản hồi trong vòng 12 ngày
-
set_key and unset_key don't fsync before replacing the .env fileCó thể đã có người làm @Imkkey đã nhận 40 ngày trước. Đang mởenhancement
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 72/100
theskumar/python-dotenv#713 ·
Maintainer thường phản hồi trong vòng 12 ngày
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 28/100
theskumar/python-dotenv#693 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 12 ngày
-
python-dotenv installation without cli masks python-dotenv cliCó thể đã có người làm @gyanu2507 đã nhận 80 ngày trước. Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 55/100
theskumar/python-dotenv#683 · 4 bình luận ·
Maintainer thường phản hồi trong vòng 12 ngày
Tất cả issue của theskumar/python-dotenv
Issue tương tự
-
release
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
MichaelYcJo/SpecSeal#1535 ·
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
valentinfrlch/ha-llmvision#769 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 75/100
daniel-ospina/tortoise#11937 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
good first issue help wanted python up-for-grabs
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
andrewsiah/agentswarm-data-tasks#238 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
cadence-workflow/cadence-ai-samples#175 ·
Maintainer thường phản hồi trong vòng 1 ngày