How to pass a binary file as stdin to a Docker containerized Python script using argparse?
问题 Update based on Anthony Sottile's Answer I re-implemented his solution to simplify the problem. Lets take Docker and Django out of the equation. The goal is to use Pandas to read excel by both of the following methods: python example.py - < /path/to/file.xlsx cat /path/to/file.xlsx | python example.py - where example.py is reproduced below: import argparse import contextlib from typing import IO import sys import pandas as pd @contextlib.contextmanager def file_ctx(filename: str) -> IO[bytes]