J
Jugdish
Why doesn't the following work?
import a
import b
class A:
pass
import pkg.subpkg.a
class B(pkg.subpkg.a.A):
pass
Traceback (most recent call last):
File "pkg/subpkg/b.py", line 1, in ?
import pkg.subpkg.a
File "$HOME/pkg/subpkg/__init__.py", line 2, in ?
import b
File "$HOME/pkg/subpkg/b.py", line 2, in ?
class B(pkg.subpkg.a.A):
AttributeError: 'module' object has no attribute 'subpkg'
# empty$HOME/pkg/__init__.py
$HOME/pkg/subpkg/__init__.py
$HOME/pkg/subpkg/a.py
$HOME/pkg/subpkg/b.py
import a
import b
class A:
pass
import pkg.subpkg.a
class B(pkg.subpkg.a.A):
pass
Traceback (most recent call last):
File "pkg/subpkg/b.py", line 1, in ?
import pkg.subpkg.a
File "$HOME/pkg/subpkg/__init__.py", line 2, in ?
import b
File "$HOME/pkg/subpkg/b.py", line 2, in ?
class B(pkg.subpkg.a.A):
AttributeError: 'module' object has no attribute 'subpkg'