Skip to content

load_dotenv fails to find .env file by default under python 3.13 #562

@mpounsett

Description

@mpounsett

When using python 3.13, load_dotenv() requires an explicit path to a dotenv file in the current directory.

% cat .env
FOO="bar"
Python 3.12.9 (main, Mar 24 2025, 18:36:22) [Clang 16.0.0 (clang-1600.0.26.6)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import dotenv, dotenv.version
>>> dotenv.version.__version__
'1.0.1'
>>> dotenv.load_dotenv()
True

Python 3.12.9 (main, Mar 24 2025, 18:36:22) [Clang 16.0.0 (clang-1600.0.26.6)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import dotenv, dotenv.version
>>> dotenv.version.__version__
'1.1.0'
>>> dotenv.load_dotenv()
True

Python 3.13.3 (main, May 17 2025, 17:59:15) [Clang 17.0.0 (clang-1700.0.13.3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import dotenv, dotenv.version
>>> dotenv.version.__version__
'1.0.1'
>>> dotenv.load_dotenv()
False
>>> dotenv.load_dotenv('.env')
True

Python 3.13.3 (main, May 17 2025, 17:59:15) [Clang 17.0.0 (clang-1700.0.13.3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import dotenv, dotenv.version
>>> dotenv.version.__version__
'1.1.0'
>>> dotenv.load_dotenv()
False
>>> dotenv.load_dotenv('.env')
True

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions