import help

placid Bulkan at gmail.com
Tue Apr 11 02:33:43 EDT 2006


Dennis Lee Bieber wrote:

> On 10 Apr 2006 20:55:31 -0700, "placid" <Bulkan at gmail.com> declaimed the
> following in comp.lang.python:
>
>
> >
> > Traceback (most recent call last):
> >   File "LinkedList.py", line 7, in ?
> >     main()
> >   File "LinkedList.py", line 4, in main
> >     n = Node("test")
> > NameError: global name 'Node' is not defined
> >
> 	That is NOT the same code as you posted.
>
> 	You posted:
> import sys
> import node
>
> def main():
>    print "Does nothin ATM, as it doesnt work"
>
> main()
>
> 	Line 4 of that is "def main():"
>
> 	If you have any .pyc or .pyo files in the same directory as your
> source, delete them, try again, and show us what happened.
>
> 	BTW: as for the code that is being run... IT NEEDS
>
> 	n = node.Node("test")
>
> 	You imported a module "node", but the class definition named "Node"
> is INSIDE the module -- so you have to specify
> 		module.class
> to access it...
> --
>  > ============================================================== <
>  >   wlfraed at ix.netcom.com  | Wulfraed  Dennis Lee Bieber  KD6MOG <
>  >      wulfraed at dm.net     |       Bestiaria Support Staff       <
>  > ============================================================== <
>  >           Home Page: <http://www.dm.net/~wulfraed/>            <
>  >        Overflow Page: <http://wlfraed.home.netcom.com/>        <


Sorry, i left some code out, my bad, LinkedList.py contains (well it
doesnt anymore, but originally did)

import node

def main():
   n = Node("Test")
   print n.element

main()


but now i know why this doesnt work and the solution (see previous post
of mine)


thanks for all the help!




More information about the Python-list mailing list