Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Log output stuck when printing emoji to internalConsole with python #934

Closed
mokizzz opened this issue May 12, 2022 · 2 comments
Closed

Log output stuck when printing emoji to internalConsole with python #934

mokizzz opened this issue May 12, 2022 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@mokizzz
Copy link

mokizzz commented May 12, 2022

Issue Type: Bug

Steps

Change the "console" to "internalConsole" in .vscode/launch.json:

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Python: 当前文件",
            "type": "python",
            "request": "launch",
            "program": "${file}",
            "console": "internalConsole",
            "justMyCode": true
        }
    ]
}

Then print several lines with some emoji in a python file test.py:

print("😀")
print("🙄")
print("🎈")
print("🎨")

Finally run this file with F5, and check in internalConsole. The output only displays 1 line:

😀

In summary, the 1st emoji will block following outputs.

VS Code version: Code 1.67.1 (da15b6fd3ef856477bf6f4fb29ba1b7af717770d, 2022-05-06T12:37:03.389Z)
OS version: Windows_NT x64 10.0.19044
Restricted Mode: No

System Info
Item Value
CPUs Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz (12 x 3192)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
oop_rasterization: enabled
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_renderer: enabled_on
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
Load (avg) undefined
Memory (System) 7.80GB (0.56GB free)
Process Argv --crash-reporter-id 45a58105-8e71-4a36-819b-e9d41efdd065
Screen Reader no
VM 44%
Extensions (44)
Extension Author (truncated) Version
alda abh 0.1.0
emoji-log-vscode ahm 1.0.0
github-markdown-preview bie 0.3.0
markdown-checkbox bie 0.3.2
markdown-emoji bie 0.2.1
markdown-footnotes bie 0.0.7
markdown-mermaid bie 1.13.2
markdown-preview-github-styles bie 1.0.1
markdown-yaml-preamble bie 0.1.0
vscode-markdownlint Dav 0.47.0
prettier-vscode esb 9.5.0
pine-script-syntax-highlighter ex- 1.0.5
copilot Git 1.19.5865
gc-excelviewer Gra 4.2.54
vscode-wordcount-cjk hol 1.3.1
latex-workshop Jam 8.26.0
vsc-python-indent Kev 1.15.0
MagicPython mag 1.1.0
rainbow-csv mec 2.3.0
vscode-docker ms- 1.22.0
vscode-language-pack-zh-hans MS- 1.67.3
python ms- 2022.6.1
vscode-pylance ms- 2022.4.3
jupyter ms- 2022.4.1011282140
jupyter-keymap ms- 1.0.0
jupyter-renderers ms- 1.0.6
remote-ssh ms- 0.80.0
remote-ssh-edit ms- 0.80.0
vscode-remote-extensionpack ms- 0.21.0
latex-formatter nic 1.0.5
autodocstring njp 0.6.1
material-icon-theme PKi 4.17.0
vscode-thunder-client ran 1.16.3
vscode-yaml red 1.7.0
rainbow-fart sae 1.4.1
vscode-open san 0.1.0
markdown-preview-enhanced shd 0.6.2
vs-picgo Spa 2.1.6
python tht 0.2.3
vscode-wakatime Wak 18.1.2
vscode-icons-mac way 7.25.3
vscode-todo-highlight way 1.0.5
markdown-pdf yza 1.4.4
markdown-all-in-one yzh 3.4.3

(8 theme extensions excluded)

A/B Experiments
vsliv368cf:30146710
vsreu685:30147344
python383cf:30185419
vspor879:30202332
vspor708:30202333
vspor363:30204092
vstes627:30244334
pythonvspyl392:30443607
pythontb:30283811
pythonvspyt551:30345470
pythonptprofiler:30281270
vshan820:30294714
vstes263:30335439
pythondataviewer:30285071
vscod805:30301674
pythonvspyt200:30340761
binariesv615:30325510
bridge0708:30335490
bridge0723:30353136
vsaa593cf:30376535
vsc1dst:30438360
pythonvs932:30410667
wslgetstarted:30449410
pythonvsnew555:30457759
vscscmwlcmt:30465135
cppdebugcf:30475217
vscaat:30438848
vsclangdf:30486550

@roblourens
Copy link
Member

I can repro this, but only on windows. It seems like vscode only gets one output event from the debug adapter for the first line, and the rest are never sent.

@roblourens roblourens transferred this issue from microsoft/vscode May 13, 2022
@roblourens roblourens removed their assignment May 14, 2022
@karthiknadig karthiknadig transferred this issue from microsoft/vscode-python May 16, 2022
@int19h int19h added the bug Something isn't working label May 25, 2022
@int19h int19h self-assigned this Jun 20, 2022
@int19h
Copy link
Contributor

int19h commented Jun 22, 2022

When capturing output, debugpy tees it back to stdout/err using whatever encoding Python uses for those by default - this would normally be the "locale for non-Unicode applications" codepage, unless you forced your console into UTF-8 mode. As those codepages are non-Unicode, they cannot handle symbols such as emoji.

In this case, though, it shouldn't matter because stdout/err is a null bucket - the Debug Console pane gets its output using a different mechanism. However, the output capture logic didn't properly handle the error, preventing further capture from working.

int19h pushed a commit to int19h/debugpy that referenced this issue Jun 22, 2022
…nsole with python

Gracefully handle encoding and write errors in the launcher when capturing output.
@int19h int19h closed this as completed in 627bc1d Jun 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants