Opened 12 years ago

Closed 6 years ago

#7762 closed New feature (fixed)

management prints full path to script when command error occurs

Reported by: miracle2k Owned by: nobody
Component: Core (Management commands) Version: master
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


PS > django-admin startapp --invalid
Usage: G:\Programme\Python\25\Scripts\ startapp [options] [appname]

Fixed by using os.path.basename() in BaseCommand.run_from_argv.

Change History (10)

comment:1 Changed 12 years ago by Malcolm Tredinnick

Resolution: wontfix
Status: newclosed

That change would mean it gives the wrong results when you run it from some relative path on any Unix-derived system. The only small visual inconsistency here is that Windows gives slightly non-standard values for sys.argv[0] (the traditional return value is the path from where the command is run -- a relative path, not an absolute one). Plus, the value displayed for Windows isn't actually wrong. So I don't think this is worth doing -- replacing a correct display with something that will be incorrect in certain other situations would be a regression.

comment:2 Changed 12 years ago by miracle2k

Resolution: wontfix
Status: closedreopened

Hm, are you sure Malcolm? The *basename(sys.argv[0])* approach is also used in management.init when handling errors not specific to a certain command:

michael@giver:/$ /usr/bin/ help startapp 2>&1| head -n 1
Usage: startapp [options] [appname]
michael@giver:/$ /usr/bin/ startapp --invalid 2>&1| head -n 1
Usage: /usr/bin/ startapp [options] [appname]

That seems like an inconsistency both on Windows and *nix. basename() should return the actual filename (presumably what we would want) on all platforms.

comment:3 Changed 12 years ago by Eric Holscher

milestone: 1.0 maybe
Triage Stage: UnreviewedDesign decision needed

comment:4 Changed 12 years ago by Jacob

milestone: 1.0 maybe

comment:5 Changed 12 years ago by Jacob

Triage Stage: Design decision neededAccepted

comment:6 Changed 9 years ago by Luke Plant

Severity: Normal
Type: New feature

comment:7 Changed 8 years ago by Aymeric Augustin

UI/UX: unset

Change UI/UX from NULL to False.

comment:8 Changed 8 years ago by Aymeric Augustin

Easy pickings: unset

Change Easy pickings from NULL to False.

comment:9 Changed 7 years ago by Aymeric Augustin

Status: reopenednew

comment:10 Changed 6 years ago by Claude Paroz <claude@…>

Resolution: fixed
Status: newclosed

In c24e979ece2729716593291d3ebd81fdf7fc3b7d:

Fixed #7762 -- Hidden full script name in command error output

Note: See TracTickets for help on using tickets.
Back to Top