diff --git a/django/core/management/commands/dbshell.py b/django/core/management/commands/dbshell.py
index a6b5427..14a1f77 100644
a
|
b
|
|
1 | 1 | from optparse import make_option |
| 2 | import errno |
2 | 3 | |
3 | 4 | from django.core.management.base import BaseCommand, CommandError |
4 | 5 | from django.db import connections, DEFAULT_DB_ALIAS |
… |
… |
class Command(BaseCommand):
|
19 | 20 | connection = connections[options.get('database', DEFAULT_DB_ALIAS)] |
20 | 21 | try: |
21 | 22 | connection.client.runshell() |
22 | | except OSError: |
23 | | # Note that we're assuming OSError means that the client program |
24 | | # isn't installed. There's a possibility OSError would be raised |
25 | | # for some other reason, in which case this error message would be |
26 | | # inaccurate. Still, this message catches the common case. |
27 | | raise CommandError('You appear not to have the %r program installed or on your path.' % \ |
28 | | connection.client.executable_name) |
| 23 | except OSError, er: |
| 24 | # In case the client program's executable is not found display an |
| 25 | # appropriate error message else raise the exception for user to |
| 26 | # figure out what is wrong |
| 27 | if er.errno == errno.ENOENT: |
| 28 | raise CommandError('You appear not to have the %r program installed or on your path.' % \ |
| 29 | connection.client.executable_name) |
| 30 | else: |
| 31 | raise |