Skip to content

typer.echo() generates TypeError: a bytes-like object is required, not 'str' #884

Closed
@PodioSpaz

Description

@PodioSpaz

When using typer.echo() or typer.secho() I get...

bpython version 0.21 on top of Python 3.9.1 /home/demo/.cache/pypoetry/virtualenvs/poetry-test-XzZpibJX-py3.9/bin/python
>>> import typer
>>> typer.echo('hello')
Traceback (most recent call last):
  File "<input>", line 1, in <module>
    typer.echo('hello')
  File "/home/demo/.cache/pypoetry/virtualenvs/poetry-test-XzZpibJX-py3.9/lib/python3.9/site-packages/click/utils.py", line 272, in echo
    file.write(message)
  File "/home/demo/.cache/pypoetry/virtualenvs/poetry-test-XzZpibJX-py3.9/lib/python3.9/site-packages/bpython/curtsiesfrontend/coderunner.py", line 218, in write
    self.on_write(s, *args, **kwargs)
  File "/home/demo/.cache/pypoetry/virtualenvs/poetry-test-XzZpibJX-py3.9/lib/python3.9/site-packages/bpython/curtsiesfrontend/repl.py", line 1247, in send_to_stdouterr
    lines = output.split("\n")
TypeError: a bytes-like object is required, not 'str'

This error does not occur with the Python REPL or ptpython.

Tested with Python 3.8.5 and 3.9.1
Typer version: 0.3.2
bpython version: 0.21

A similar problem was mentioned in another issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions