[New-bugs-announce] [issue17030] strange import visibility

Stephan report at bugs.python.org
Fri Jan 25 13:57:46 CET 2013

New submission from Stephan:

$ cat a.py
import dbus
import b
print "Hello, World."
$ cat b.py
import dbus.mainloop.glib
$ python a.py
Hello, World.

If I remove the “import b” line, the output is:

$ python a.py
Traceback (most recent call last):
  File "a.py", line 3, in <module>
AttributeError: 'module' object has no attribute 'mainloop'

In my opinion this is inconsistent. Either both versions should fail with that error, because “dbus.mainloop.glib” is imported in “b”, not “a”; or both should succeed, because “a” imports dbus.

This is Python 2.7.3 and python-dbus 1.0.0 on Ubuntu 12.4.2

components: Interpreter Core
messages: 180574
nosy: geryon
priority: normal
severity: normal
status: open
title: strange import visibility
type: behavior
versions: Python 2.7

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list