ImportError: No module named ‘exceptions’


The error:

Traceback (most recent call last):
  File "D:\pyhomelib\mainwindow.py", line 19, in <module>
    from sqlquerymodel import SqlQueryModel
  File "D:\pyhomelib\sqlquerymodel.py", line 4, in <module>
    from exceptions import Exception
ImportError: No module named 'exceptions'

The problem:

from exceptions import Exception

Explanation:

In Python 3, exceptions module was removed and all standard exceptions were moved to builtin module. 
Thus meaning that there is no more need to do explicit import of any standard exceptions.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: