Skip to content

FileBinaryRead: file is already closed #209

Open
@danjac

Description

@danjac

Trying to run this command using FileBinaryRead e.g.

./manage.py my_command path_to_file.txt

app = Typer()

@app.command()
def handle(self, file: typer.FileBinaryRead) -> None:
    """Print out file"""
    for chunk in file:
        print(chunk)

ValueError: I/O operation on closed file

In the Typer docs this should work: https://typer.tiangolo.com/tutorial/parameter-types/file/#filebinaryread

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions