【问题标题】:Anki-addon with Python UnicodeEncodeError带有 Python UnicodeEncodeError 的 Anki 插件
【发布时间】:2022-08-14 15:19:30
【问题描述】:

这个插件通常会以 PDF 格式导出 Anki Notes。我该如何修复它?

Debuginformationen:
Anki 2.1.53 (96bacf79) Python 3.9.7 Qt 5.15.2 PyQt 5.15.5
Platform: Windows 10
Flags: frz=True ao=True sv=2
Add-ons, last update check: 2022-07-11 08:21:44

Caught exception:
Traceback (most recent call last):
  File \"C:\\Users\\lombe\\AppData\\Roaming\\Anki2\\addons21\\anki-export\\__init__.py\", line 37, in <lambda>
    a.triggered.connect(lambda: export_cards(browser.selectedCards()))
  File \"C:\\Users\\lombe\\AppData\\Roaming\\Anki2\\addons21\\anki-export\\__init__.py\", line 30, in export_cards
    file.write(output_text)
  File \"tempfile\", line 474, in func_wrapper
  File \"encodings.cp1252\", line 19, in encode
UnicodeEncodeError: \'charmap\' codec can\'t encode character \'\\u03c6\' in position 45247: character maps to <undefined>

    标签: python anki


    【解决方案1】:

    确保在 open() 中指定 UTF-8 编码。例如:

    open('myfile', encoding='utf-8')
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-11-20
      • 2019-02-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多