astral-sh/uv · error
Cannot run a Python module from stdin
Error message
Cannot run a Python module from stdin
What it means
Error "Cannot run a Python module from stdin" thrown in astral-sh/uv.
Source
Thrown at crates/uv/src/commands/project/run.rs:1521
/// Determine the [`ParsedRunCommand`] for a given set of arguments.
pub(crate) fn from_args(
command: &ExternalCommand,
module: bool,
script: bool,
gui_script: bool,
) -> anyhow::Result<Self> {
let (target, args) = command.split();
let Some(target) = target else {
return Ok(Self::Ready(RunCommand::Empty));
};
if target.eq_ignore_ascii_case("-") {
let mut buf = Vec::with_capacity(1024);
std::io::stdin().read_to_end(&mut buf)?;
return if module {
Err(anyhow!("Cannot run a Python module from stdin"))
} else if gui_script {
Ok(Self::Ready(RunCommand::PythonGuiStdin(buf, args.to_vec())))
} else {
Ok(Self::Ready(RunCommand::PythonStdin(buf, args.to_vec())))
};
}
let target_path = PathBuf::from(target);
// Determine whether the user provided a remote script.
if target_path.starts_with("http://") || target_path.starts_with("https://") {
// Only continue if we are absolutely certain no local file exists.
//
// We don't do this check on Windows since the file path would
// be invalid anyway, and thus couldn't refer to a local file.
if !cfg!(unix) || matches!(target_path.try_exists(), Ok(false)) {
let url = DisplaySafeUrl::parse(&target.to_string_lossy())?;
return Ok(Self::PendingRemote(PendingRemoteRunCommand {View on GitHub (pinned to f1a42680ff)
When it happens
Trigger: Thrown at crates/uv/src/commands/project/run.rs:1521 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of astral-sh/uv@f1a42680ff (2026-08-16).
Data as JSON: /api/errors/e608aa7458c4fb94.
Report an issue: GitHub.