python/cpython · error
need to specify the name, input and output paths
Error message
need to specify the name, input and output paths
What it means
Usage error from Programs/_freeze_module.c's main(): the program takes exactly three positional arguments (frozen module name, input source path, output C path) and argc != 4 (program + 3 args) means it was invoked with the wrong number of arguments; it prints this usage line and exits with status 2.
Source
Thrown at Programs/_freeze_module.c:230
return -1;
}
fclose(outfile);
return 0;
}
int
main(int argc, char *argv[])
{
const char *name, *inpath, *outpath;
_PyImport_FrozenBootstrap = no_modules;
_PyImport_FrozenStdlib = no_modules;
_PyImport_FrozenTest = no_modules;
PyImport_FrozenModules = NULL;
_PyImport_FrozenAliases = aliases;
if (argc != 4) {
fprintf(stderr, "need to specify the name, input and output paths\n");
return 2;
}
name = argv[1];
inpath = argv[2];
outpath = argv[3];
runtime_init();
const char *text = read_text(inpath);
if (text == NULL) {
goto error;
}
PyObject *marshalled = compile_and_marshal(name, text);
free((char *)text);
if (marshalled == NULL) {
goto error;
}View on GitHub (pinned to bc6749cc3b)
Solutions
- Invoke with exactly three args: `_freeze_module <name> <inpath> <outpath>`
- Inspect the failing command line in the build log and fix the empty/missing variable
- Copy the exact command from the Makefile rule rather than retyping it
Defensive patterns
Strategy: validation
Validate before calling
# shell: enforce the exact freezer signature before running
# freeze() { [ $# -eq 3 ] || { echo 'usage: freeze NAME IN OUT' >&2; return 2; }; ./_freeze_module "$@"; } Prevention
- Wrap the freezer in a shell function that checks arg count == 3
- set -u in build scripts so empty variables fail early instead of shifting argc
- Copy commands verbatim from the Makefile when reproducing build steps
When it happens
Trigger: Running `_freeze_module name in.py` (missing out path), with extra args, or with none; build scripts/regen targets constructed with a missing variable so the command line degenerates.
Common situations: Manually reproducing a freeze step from a Makefile line and dropping an argument; build system variable (e.g. $OUT) empty so the word count is short; wrapper scripts mangling quoting so args merge or split.
Related errors
- cannot open '%s' for reading
- cannot fstat '%s'
- could not allocate %ld bytes
- read too short: got %ld instead of %ld bytes
- cannot open '%s' for writing
AI-assisted analysis of python/cpython@bc6749cc3b (2026-08-14).
Data as JSON: /api/errors/6012820be32aecbe.
Report an issue: GitHub.