On Fri, Sep 13, 2013 at 12:49 PM, Saju M <sajup...@gmail.com> wrote: > Import sub-modules with alias. > Is it a bug ? > >>>> >>>> import json >>>> from json import tool >>>> > > -------- > >>>> >>>> import json as sjson >>>> from sjson import tool > Traceback (most recent call last): > File "<stdin>", line 1, in <module> > ImportError: No module named sjson >>>>
import and from serve to import packages using their canonical package names into the appropriate module name spaces. The alias is applied as a part of the importing process and the target of this is the module name space. Since from looks at the canonical names (in the virtualenv etc.) from sjson means it should look up a package on the disk called sjson (not locate sjson out of module namespace) Dhananjay _______________________________________________ BangPypers mailing list BangPypers@python.org https://mail.python.org/mailman/listinfo/bangpypers