python/cpython · error

Usage: seticon ICON TARGET

Error message

Usage: seticon ICON TARGET

What it means

Usage message from the macOS build helper seticon (Mac/BuildScript/seticon.m), a small Cocoa tool that stamps an icon onto a file. It prints 'Usage: seticon ICON TARGET' to stderr and exits 1 when argc != 3 — i.e. the program was not given exactly one icon path and one target path.

Source

Thrown at Mac/BuildScript/seticon.m:10

/*
 * Simple tool for setting an icon on a file.
 */
#import <Cocoa/Cocoa.h>
#include <stdio.h>

int main(int argc, char** argv)
{
	if (argc != 3) {
		fprintf(stderr, "Usage: seticon ICON TARGET");
		return 1;
	}

	NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
	NSString* iconPath = [NSString stringWithUTF8String:argv[1]];
	NSString* filePath = [NSString stringWithUTF8String:argv[2]];

	[NSApplication sharedApplication];

	[[NSWorkspace sharedWorkspace]
		setIcon: [[NSImage alloc] initWithContentsOfFile: iconPath]
		forFile: filePath
		options: 0];
	[pool release];
	return 0;
}

View on GitHub (pinned to bc6749cc3b)

Solutions

  1. Invoke with exactly two arguments: ./seticon path/to/icon.icns path/to/target
  2. Quote both paths in shell recipes: "$(RESOURCES_DIR)/icon.icns" "$(APP_TARGET)"
  3. Verify both paths exist before calling (the tool itself will proceed to NSImage init otherwise)

Example fix

# before
./seticon $ICON $TARGET extra
# after
./seticon "$ICON" "$TARGET"
Defensive patterns

Strategy: validation

Validate before calling

# bash: check arity and inputs before calling the tool
[ $# -eq 2 ] && [ -f "$1" ] && [ -e "$2" ] || { echo "Usage: seticon ICON TARGET" >&2; exit 1; }
./seticon "$1" "$2"

Prevention

When it happens

Trigger: Running ./seticon with 0, 1, or 3+ arguments; invoking it from a build script where one of the two expected paths expanded to empty or the paths were quoted as a single argument.

Common situations: Broken build scripts after relocating resources; Makefile recipes passing unquoted variables containing spaces; invoking the tool with flags it does not support (it takes none).

Related errors


AI-assisted analysis of python/cpython@bc6749cc3b (2026-08-14). Data as JSON: /api/errors/70540c1c0f6b43bf. Report an issue: GitHub.