Ticket #8238: db.diff

File db.diff, 1.0 KB (added by Guido van Rossum <guido@…>, 16 years ago)

patch

  • db/__init__.py

     
    2424        # The database backend wasn't found. Display a helpful error message
    2525        # listing all possible (built-in) database backends.
    2626        backend_dir = os.path.join(__path__[0], 'backends')
    27         available_backends = [f for f in os.listdir(backend_dir) if not f.startswith('_') and not f.startswith('.') and not f.endswith('.py') and not f.endswith('.pyc')]
     27        try:
     28            available_backends = [f for f in os.listdir(backend_dir) if not f.startswith('_') and not f.startswith('.') and not f.endswith('.py') and not f.endswith('.pyc')]
     29        except EnvironmentError:
     30            available_backends = []
    2831        available_backends.sort()
    2932        if settings.DATABASE_ENGINE not in available_backends:
    3033            raise ImproperlyConfigured, "%r isn't an available database backend. Available options are: %s\nError was: %s" % \
Back to Top