[Tutor] from import works but I'm flubbing a package import
Jim Mooney
cybervigilante at gmail.com
Mon May 20 03:30:58 CEST 2013
Still puzzling on imports.
I have the jimlib module in Lib with the proper __init__.py . Inside
it is the program bark.py, with data item zarf that contains string
'fraz'
It also contains the function barker.
def barker():
print 'bark, bark'
If I do the below everything works:
from jimlib import bark
print bark.zarf
bark.barker()
But if I just do
import jimlib and chain the program and its functions or data
nothing works.
If I try jimlib.bark.barker() after importing jimlib or print
jimlib.bark.zarf I get the error that the module has no attribute
'bark'
I'm doing the from statement right but what am I doing wrong with just
importing the whole module and chaining out bark (for bark.py) and the
function or data following?
Using Py27 and Win 7
--
Jim Mooney
There is no such thing as a failed experiment
More information about the Tutor
mailing list