Opened 7 years ago

Closed 10 months 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

Description

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

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

Change History (10)

comment:1 Changed 7 years ago by mtredinnick

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to wontfix
  • Status changed from new to closed

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 7 years ago by miracle2k

  • Resolution wontfix deleted
  • Status changed from closed to reopened

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/django-admin.py help startapp 2>&1| head -n 1
Usage: django-admin.py startapp [options] [appname]
michael@giver:/$ /usr/bin/django-admin.py startapp --invalid 2>&1| head -n 1
Usage: /usr/bin/django-admin.py startapp [options] [appname]
michael@giver:/$

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 7 years ago by ericholscher

  • milestone set to 1.0 maybe
  • Triage Stage changed from Unreviewed to Design decision needed

comment:4 Changed 7 years ago by jacob

  • milestone 1.0 maybe deleted

comment:5 Changed 7 years ago by jacob

  • Triage Stage changed from Design decision needed to Accepted

comment:6 Changed 4 years ago by lukeplant

  • Severity set to Normal
  • Type set to New feature

comment:7 Changed 3 years ago by aaugustin

  • UI/UX unset

Change UI/UX from NULL to False.

comment:8 Changed 3 years ago by aaugustin

  • Easy pickings unset

Change Easy pickings from NULL to False.

comment:9 Changed 2 years ago by aaugustin

  • Status changed from reopened to new

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

  • Resolution set to fixed
  • Status changed from new to closed

In c24e979ece2729716593291d3ebd81fdf7fc3b7d:

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

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