Opened 16 years ago
Closed 11 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: | dev |
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 by , 16 years ago
Resolution: | → wontfix |
---|---|
Status: | new → closed |
comment:2 by , 16 years ago
Resolution: | wontfix |
---|---|
Status: | closed → 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 by , 16 years ago
milestone: | → 1.0 maybe |
---|---|
Triage Stage: | Unreviewed → Design decision needed |
comment:4 by , 16 years ago
milestone: | 1.0 maybe |
---|
comment:5 by , 16 years ago
Triage Stage: | Design decision needed → Accepted |
---|
comment:6 by , 14 years ago
Severity: | → Normal |
---|---|
Type: | → New feature |
comment:9 by , 12 years ago
Status: | reopened → new |
---|
comment:10 by , 11 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
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.