localstack / localstack/localstack-cli

unicode encoding error in windows

未關閉
#2 1 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

bug
主要語言
Makefile
星號
27
分支
9
PR 合併指標
30 天內沒有已合併 PR

描述

when running the packaged CLI for windows, i get the following errors, which blocks the startup in the cockpit app https://github.com/localstack/localstack-desktop (where the same error is thrown when executing using `spawn` in a node process). i can reproduce it in a MinGW environment like GitBash

```
thomas@DESKTOP-HDNUHFQ MINGW64 ~
$ ./AppData/Local/Programs/localstack-cockpit/resources/vendor/win32/localstack-packaged-cli/localstack.exe start
Traceback (most recent call last):
File "main.py", line 6, in
File "localstack\cli\main.py", line 6, in main
File "localstack\cli\plugin.py", line 15, in __call__
File "click\core.py", line 1128, in __call__
File "click\core.py", line 1053, in main
File "click\core.py", line 1659, in invoke
File "click\core.py", line 1395, in invoke
File "click\core.py", line 754, in invoke
File "localstack\cli\localstack.py", line 122, in cmd_start
File "localstack\cli\localstack.py", line 435, in print_version
File "rich\console.py", line 1637, in print
File "rich\console.py", line 837, in __exit__
File "rich\console.py", line 795, in _exit_buffer
File "rich\console.py", line 1927, in _check_buffer
File "encodings\cp1252.py", line 19, in encode
UnicodeEncodeError: 'charmap' codec can't encode character '\U0001f4bb' in position 1: character maps to
*** You may need to add PYTHONIOENCODING=utf-8 to your environment ***
[13272] Failed to execute script 'main' due to unhandled exception!

__ _______ __ __
/ / ____ _________ _/ / ___// /_____ ______/ /__
/ / / __ \/ ___/ __ `/ /\__ \/ __/ __ `/ ___/ //_/
/ /___/ /_/ / /__/ /_/ / /___/ / /_/ /_/ / /__/ ,<
/_____/\____/\___/\__,_/_//____/\__/\__,_/\___/_/|_|

```

some observations:

* it works using powershell
* cp1252 refers to windows encoding: https://en.wikipedia.org/wiki/Windows-1252
* this is not related to the locale configuration
```
thomas@DESKTOP-HDNUHFQ MINGW64 ~
$ locale
LANG=en_US.utf8
LC_CTYPE="en_US.utf8"
LC_NUMERIC="en_US.utf8"
LC_TIME="en_US.utf8"
LC_COLLATE="en_US.utf8"
LC_MONETARY="en_US.utf8"
LC_MESSAGES="en_US.utf8"
LC_ALL=en_US.utf8
```

貢獻指南

開啟貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

研究方向

首先,在 MinGW 或 GitBash 環境中重現封裝 CLI 的失敗,並檢查 localstack/cli/localstack.py 中 print_version 附近的程式碼,traceback 會在那裡到達 Rich 輸出。將該行為與 PowerShell 進行比較,並驗證 CLI 能夠在沒有 cp1252 UnicodeEncodeError 的情況下成功啟動。

由索引模型根據 Issue 內容生成。

評估

技術堆疊
python
領域
cli
Issue 類型
缺陷
難度
3/5
預估耗時
1-2 天
活躍度
停滯
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。