summaryrefslogtreecommitdiff
path: root/Python/import.c
diff options
context:
space:
mode:
Diffstat (limited to 'Python/import.c')
-rw-r--r--Python/import.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/Python/import.c b/Python/import.c
index 77252459d9..0eb44f2311 100644
--- a/Python/import.c
+++ b/Python/import.c
@@ -149,10 +149,14 @@ get_module(m, name, m_ret)
fp = open_module(name, ".py", namebuf);
if (fp == NULL) {
- if (m == NULL)
- err_setstr(NameError, name);
- else
- err_setstr(IOError, "no module source file");
+ if (m == NULL) {
+ sprintf(namebuf, "no module named %.200s", name);
+ err_setstr(ImportError, namebuf);
+ }
+ else {
+ sprintf(namebuf, "no source for module %.200s", name);
+ err_setstr(ImportError, namebuf);
+ }
return NULL;
}
/* Get mtime -- always useful */