{
  "id": 57473,
  "title": "Writing log file with Russian Characters",
  "url": "/competitions/avito-demand-prediction/discussion/57473",
  "author_name": "Samrat Pandiri",
  "post_date": "2018-05-24T05:58:51.419000",
  "votes": 0,
  "comment_count": 0,
  "views": 0,
  "content": "<p>I'm trying the below approach to write the log file but getting an error. Appreciate any help</p>\n\n<pre><code>sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-16')\nlog_file_name = \"./log_%s.txt\" % file_counter\nsys.stdout = open(log_file_name,'wt')\n</code></pre>\n\n<p>UnicodeEncodeError: 'charmap' codec can't encode characters in position 172-183: character maps to </p>\n\n<p>Windows 7/Spyder/Python3</p>",
  "messages": [
    {
      "id": 332957,
      "postDate": "2018-05-24T05:58:51.420Z",
      "content": "<p>I'm trying the below approach to write the log file but getting an error. Appreciate any help</p>\n\n<pre><code>sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-16')\nlog_file_name = \"./log_%s.txt\" % file_counter\nsys.stdout = open(log_file_name,'wt')\n</code></pre>\n\n<p>UnicodeEncodeError: 'charmap' codec can't encode characters in position 172-183: character maps to </p>\n\n<p>Windows 7/Spyder/Python3</p>",
      "rawMarkdown": "I'm trying the below approach to write the log file but getting an error. Appreciate any help\n\n    sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-16')\n    log_file_name = \"./log_%s.txt\" % file_counter\n    sys.stdout = open(log_file_name,'wt')\n\n\nUnicodeEncodeError: 'charmap' codec can't encode characters in position 172-183: character maps to "
    }
  ],
  "comments": [],
  "raw_markdown_by_id": {
    "332957": "I'm trying the below approach to write the log file but getting an error. Appreciate any help\n\n    sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-16')\n    log_file_name = \"./log_%s.txt\" % file_counter\n    sys.stdout = open(log_file_name,'wt')\n\n\nUnicodeEncodeError: 'charmap' codec can't encode characters in position 172-183: character maps to "
  }
}