Skip to content

UnicodeEncodeError: 'ascii' codec can't encode character #121

@rrolla

Description

@rrolla

Hi, seems it cannot parse unicode values
example
.env file

SHARE_ENDPOINTS="'Bibliotēka', 'Reģistrētie dokumenti'"

settings.py file

#!/usr/bin/env python2

import os
from dotenv import load_dotenv, find_dotenv
load_dotenv(find_dotenv())

SHARE_ENDPOINTS = os.getenv("SHARE_ENDPOINTS")
print(SHARE_ENDPOINTS)

Error traceback

Traceback (most recent call last):
  File "./bin/settings.py", line 5, in <module>
    load_dotenv(find_dotenv())
  File "/home/rolla/.local/lib/python2.7/site-packages/dotenv/main.py", line 250, in load_dotenv
    return DotEnv(f, verbose=verbose).set_as_environment_variables(override=override)
  File "/home/rolla/.local/lib/python2.7/site-packages/dotenv/main.py", line 97, in set_as_environment_variables
    os.environ[k] = v
  File "/usr/lib/python2.7/os.py", line 473, in __setitem__
    putenv(key, item)
UnicodeEncodeError: 'ascii' codec can't encode character u'\u0113' in position 8: ordinal not in range(128)

Is there some options to get this working?
Thanks.

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