Python 3 subprocess module throws error running “dir” on Windows

后端 未结 3 771
清歌不尽
清歌不尽 2021-01-06 22:58

This simple program in Python 3 throws errors. What could be the reason? This problem arose after I installed/reinstalled Python 3.5/3.6. Also

3条回答
  •  有刺的猬
    2021-01-06 23:28

    It's not an executable, but built-in to the shell. Python subprocess module can't find it, so you got an error.

    If you would like to play with subprocess module, use some existing binary, e.g. python, notepad or ping. In case you need to list folder content, please use os.listdir or os.walk.

提交回复
热议问题