On 05/19/2013 09:30 PM, Jim Mooney wrote:
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
Syntax error. Be more specific, don't just paraphrase.
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'
that's because you never imported jimlib.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
Try:
import jimlib
import jimlib.bark
--
DaveA
_______________________________________________
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor