-2

In my python env, help() return my python version is 2.7.

Then, I enter:

sys.setdefaultencoding('utf8')

and it return this error: "AttributeError: 'module' object has no attribute 'setdefaultencoding'"

But my python version is 2.7.

Anyone? Thanks a lot.

1

1 Answer 1

1

Have a look at documentation:

  • sys.setdefaultencoding: "... Once used by the site module, it is removed from the sys module’s namespace."
  • site module: "This module is automatically imported during initialization. The automatic import can be suppressed using the interpreter’s -S option."
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.