-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.

Bando
  • 1,223
  • 1
  • 12
  • 31
  • Possible duplicate of https://stackoverflow.com/questions/28127513/attributeerror-module-object-has-no-attribute-setdefaultencoding – Bando Jul 16 '20 at 18:52

1 Answers1

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."
Jan Stránský
  • 1,671
  • 1
  • 11
  • 15