Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Inconsistency with os.environ and str/unicode in Python 2 #176

Copy link
Copy link
@bbc2

Description

@bbc2
Issue body actions

In Python 2, os.environ is a map with str keys and str values, not unicode. Unfortunately, values loaded with Python-dotenv are unicode.

Example with test.py:

import os

import dotenv

dotenv.load_dotenv()
print(type(os.environ["foo"]))

and .env:

foo=bar

Results:

> python test.py
<type 'unicode'>
> env foo=bar python test.py
<type 'str'>

I think that it's probably not worth fixing given Python 2's upcoming end of life, but I'm pointing this out here because this might justify turning off some Mypy type warnings for Python 2.

theskumar

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

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.