Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

subprocess stdout capture does not seem to work on Windows

Đang mở
#882 2 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
35/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
python
Lĩnh vực
backend, operating-systems

Hướng nghiên cứu

Bắt đầu với bản tái hiện ProcessPoolExecutor trong issue và so sánh hành vi của nó trên Windows và Linux. Đọc mục changelog của ipykernel 6.0.0 mô tả việc capture subprocess stdout, sau đó lần theo đường dẫn capture liên quan. Công việc được xem là hoàn tất khi output của subprocess từ ví dụ hiển thị trên Windows mà không làm hỏng hành vi trên Linux.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

ipykernel is capturing stdout from subprocesses since ipykernel 6.0.0 according to the changelog.

On Windows it does not seem like the output of subprocesses is correctly captured. Here is a snippet to reproduce:

This came up in https://github.com/scikit-learn/scikit-learn/issues/22849#issuecomment-1068947522.

from concurrent.futures import ProcessPoolExecutor

# write local module since on Windows you can not use interactively defined functions in ProcessPoolExecutor
with open('func.py', 'w') as f:
    f.write('def func(arg): print("from subprocess, arg:", arg)')

from func import func
    
executor = ProcessPoolExecutor(max_workers=2)
future = executor.submit(func, 1)
future.result()

On Linux (output from the subprocess is visible)
image

On Windows (no output from the subprocess):
image

Windows environment details
# packages in environment at C:\Users\lesteve\mambaforge\envs\test:
#
# Name                    Version                   Build  Channel
argon2-cffi               21.3.0             pyhd8ed1ab_0    conda-forge
argon2-cffi-bindings      21.2.0          py310he2412df_1    conda-forge
asttokens                 2.0.5              pyhd8ed1ab_0    conda-forge
attrs                     21.4.0             pyhd8ed1ab_0    conda-forge
backcall                  0.2.0              pyh9f0ad1d_0    conda-forge
backports                 1.0                        py_2    conda-forge
backports.functools_lru_cache 1.6.4              pyhd8ed1ab_0    conda-forge
beautifulsoup4            4.10.0             pyha770c72_0    conda-forge
bleach                    4.1.0              pyhd8ed1ab_0    conda-forge
bzip2                     1.0.8                h8ffe710_4    conda-forge
ca-certificates           2021.10.8            h5b45459_0    conda-forge
cffi                      1.15.0          py310hcbf9ad4_0    conda-forge
colorama                  0.4.4              pyh9f0ad1d_0    conda-forge
debugpy                   1.5.1           py310h8a704f9_0    conda-forge
decorator                 5.1.1              pyhd8ed1ab_0    conda-forge
defusedxml                0.7.1              pyhd8ed1ab_0    conda-forge
entrypoints               0.4                pyhd8ed1ab_0    conda-forge
executing                 0.8.3              pyhd8ed1ab_0    conda-forge
flit-core                 3.7.1              pyhd8ed1ab_0    conda-forge
icu                       68.2                 h0e60522_0    conda-forge
importlib-metadata        4.11.3          py310h5588dad_0    conda-forge
importlib_resources       5.4.0              pyhd8ed1ab_0    conda-forge
ipykernel                 6.9.2           py310hbbfc1a7_0    conda-forge
ipython                   8.1.1           py310h5588dad_0    conda-forge
ipython_genutils          0.2.0                      py_1    conda-forge
ipywidgets                7.6.5              pyhd8ed1ab_0    conda-forge
jedi                      0.18.1          py310h5588dad_0    conda-forge
jinja2                    3.0.3              pyhd8ed1ab_0    conda-forge
jpeg                      9e                   h8ffe710_0    conda-forge
jsonschema                4.4.0              pyhd8ed1ab_0    conda-forge
jupyter                   1.0.0           py310h5588dad_7    conda-forge
jupyter_client            7.1.2              pyhd8ed1ab_0    conda-forge
jupyter_console           6.4.3              pyhd8ed1ab_0    conda-forge
jupyter_core              4.9.2           py310h5588dad_0    conda-forge
jupyterlab_pygments       0.1.2              pyh9f0ad1d_0    conda-forge
jupyterlab_widgets        1.0.2              pyhd8ed1ab_0    conda-forge
libclang                  11.1.0          default_h5c34c98_1    conda-forge
libffi                    3.4.2                h8ffe710_5    conda-forge
libpng                    1.6.37               h1d00b33_2    conda-forge
libsodium                 1.0.18               h8d14728_1    conda-forge
libzlib                   1.2.11            h8ffe710_1013    conda-forge
markupsafe                2.1.1           py310he2412df_0    conda-forge
matplotlib-inline         0.1.3              pyhd8ed1ab_0    conda-forge
mistune                   0.8.4           py310he2412df_1005    conda-forge
nbclient                  0.5.13             pyhd8ed1ab_0    conda-forge
nbconvert                 6.4.4           py310h5588dad_0    conda-forge
nbformat                  5.2.0              pyhd8ed1ab_0    conda-forge
nest-asyncio              1.5.4              pyhd8ed1ab_0    conda-forge
notebook                  6.4.10             pyha770c72_0    conda-forge
openssl                   1.1.1l               h8ffe710_0    conda-forge
packaging                 21.3               pyhd8ed1ab_0    conda-forge
pandoc                    2.17.1.1             h57928b3_0    conda-forge
pandocfilters             1.5.0              pyhd8ed1ab_0    conda-forge
parso                     0.8.3              pyhd8ed1ab_0    conda-forge
pickleshare               0.7.5                   py_1003    conda-forge
pip                       22.0.4             pyhd8ed1ab_0    conda-forge
prometheus_client         0.13.1             pyhd8ed1ab_0    conda-forge
prompt-toolkit            3.0.27             pyha770c72_0    conda-forge
prompt_toolkit            3.0.27               hd8ed1ab_0    conda-forge
psutil                    5.9.0           py310he2412df_0    conda-forge
pure_eval                 0.2.2              pyhd8ed1ab_0    conda-forge
pycparser                 2.21               pyhd8ed1ab_0    conda-forge
pygments                  2.11.2             pyhd8ed1ab_0    conda-forge
pyparsing                 3.0.7              pyhd8ed1ab_0    conda-forge
pyqt                      5.12.3          py310h5588dad_8    conda-forge
pyqt-impl                 5.12.3          py310h8a704f9_8    conda-forge
pyqt5-sip                 4.19.18         py310h8a704f9_8    conda-forge
pyqtchart                 5.12            py310h8a704f9_8    conda-forge
pyqtwebengine             5.12.1          py310h8a704f9_8    conda-forge
pyrsistent                0.18.1          py310he2412df_0    conda-forge
python                    3.10.2          h9a09f29_4_cpython    conda-forge
python-dateutil           2.8.2              pyhd8ed1ab_0    conda-forge
python_abi                3.10                    2_cp310    conda-forge
pywin32                   303             py310he2412df_0    conda-forge
pywinpty                  2.0.5           py310h00ffb61_0    conda-forge
pyzmq                     22.3.0          py310h73ada01_1    conda-forge
qt                        5.12.9               h5909a2a_4    conda-forge
qtconsole                 5.2.2              pyhd8ed1ab_1    conda-forge
qtconsole-base            5.2.2              pyhd8ed1ab_1    conda-forge
qtpy                      2.0.1              pyhd8ed1ab_0    conda-forge
send2trash                1.8.0              pyhd8ed1ab_0    conda-forge
setuptools                60.9.3          py310h5588dad_0    conda-forge
six                       1.16.0             pyh6c4a22f_0    conda-forge
soupsieve                 2.3.1              pyhd8ed1ab_0    conda-forge
sqlite                    3.37.1               h8ffe710_0    conda-forge
stack_data                0.2.0              pyhd8ed1ab_0    conda-forge
terminado                 0.13.3          py310h5588dad_0    conda-forge
testpath                  0.6.0              pyhd8ed1ab_0    conda-forge
tk                        8.6.12               h8ffe710_0    conda-forge
tornado                   6.1             py310he2412df_2    conda-forge
traitlets                 5.1.1              pyhd8ed1ab_0    conda-forge
tzdata                    2021e                he74cb21_0    conda-forge
ucrt                      10.0.20348.0         h57928b3_0    conda-forge
vc                        14.2                 hb210afc_6    conda-forge
vs2015_runtime            14.29.30037          h902a5da_6    conda-forge
wcwidth                   0.2.5              pyh9f0ad1d_2    conda-forge
webencodings              0.5.1                      py_1    conda-forge
wheel                     0.37.1             pyhd8ed1ab_0    conda-forge
widgetsnbextension        3.5.2           py310h5588dad_1    conda-forge
winpty                    0.4.3                         4    conda-forge
xz                        5.2.5                h62dcd97_1    conda-forge
zeromq                    4.3.4                h0e60522_1    conda-forge
zipp                      3.7.0              pyhd8ed1ab_1    conda-forge
zlib                      1.2.11            h8ffe710_1013    conda-forge

Ngôn ngữ chính
Python
Star
734
Fork
411
Merge trung bình
1 ngày 2 giờ
Pull request đã merge (30 ngày)
9

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của ipython/ipykernel

Tất cả issue của ipython/ipykernel

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.