ImportError when the scheme is unsupported is misleading

Bug #1130755 reported by Manuel Cerón
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Storm
New
Undecided
Unassigned

Bug Description

If you use an unsupported scheme in a connection string, for example:

>>> from storm.locals import *
>>> database = create_database("postgresql://myhost.example.com:5432/mydb")

You get an error like this one:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/srv/test.fluidinfo.com/20130220-1556/fluidinfo/src/storm/storm/database.py", line 546, in create_database
    None, None, [""])
ImportError: No module named postgresql

Note that the correct scheme is "postgres" not "postgresql".

The ImportError is very very misleading. You might think that you're missing a dependency, and spend hours trying to figure out what's going on. That's what just happened to me. :)

It would be *much better* if you catch the ImportError and then raise a different exception with a nice message saying that the scheme is unsupported. Then typos like the one that I made could be fixed easily. That would improve the usability of the library.

I'm using Storm from trunk.

Thanks.

Manuel Cerón (ceronman)
summary: - Don't raise ImportError when the scheme is unsupported
+ ImportError when the scheme is unsupported is misleading
description: updated
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.