[issue35014] asyncio subprocess accepts string as parameter which lead to UnicodeEncodeError

Rémy Hubscher [:natim] report at bugs.python.org
Thu Oct 18 06:53:44 EDT 2018


Rémy Hubscher [:natim] <hubscher.remy at gmail.com> added the comment:

I though this would be sufficient to actually reproduce the issue.
However it seems that if the system encoding is UTF-8 it does work properly.

Here is the traceback I had:

```
UnicodeEncodeError: 'ascii' codec can't encode character '\xe9' in position 69: ordinal not in range(128)
  File "worker.py", line 393, in <module>
    return_code = loop.run_until_complete(main(loop))
  File "asyncio/base_events.py", line 467, in run_until_complete
    return future.result()
  File "worker.py", line 346, in main
    '-f mp4', '-o', '{}/{}.mp4'.format(download_tempdir, video_id))
  File "worker.py", line 268, in run_command
    proc = await create
  File "asyncio/subprocess.py", line 225, in create_subprocess_exec
    stderr=stderr, **kwds)
  File "asyncio/base_events.py", line 1191, in subprocess_exec
    bufsize, **kwargs)
  File "asyncio/unix_events.py", line 191, in _make_subprocess_transport
    **kwargs)
  File "asyncio/base_subprocess.py", line 39, in __init__
    stderr=stderr, bufsize=bufsize, **kwargs)
  File "asyncio/unix_events.py", line 697, in _start
    universal_newlines=False, bufsize=bufsize, **kwargs)
  File "python3.6/subprocess.py", line 707, in __init__
    restore_signals, start_new_session)
  File "python3.6/subprocess.py", line 1267, in _execute_child
    restore_signals, start_new_session, preexec_fn)
```

----------
Added file: https://bugs.python.org/file47879/demo.py

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue35014>
_______________________________________


More information about the Python-bugs-list mailing list