Bod Soutar | 12 Jun 2012 10:07

Issue with classes

Hi,

I am having some difficulty calling a class method from a different class.
When I run the attached script like this "python cheatsheet.py --list"

C:\>python cheatsheet.py --list
done
here?
Traceback (most recent call last):
  File "cheatsheet.py", line 167, in <module>
    main()
  File "cheatsheet.py", line 165, in main
    ca.parseArgs()
  File "cheatsheet.py", line 39, in parseArgs
    self.argList()
  File "cheatsheet.py", line 96, in argList
    handle = cf.load()
NameError: global name 'cf' is not defined


So the traceback points to the issue being on line 96, specifically the call to cf.load(). cf.load() (line 147) is part of the cheatFile class (line 125), and is instantiated with cf = cheatFile() (line 161)

I confess I don't know anything about classes really so I'm probably doing something stupid, but can anyone point me in the right direction?

Thanks,
Bodsda

Attachment (cheatsheet.py): application/octet-stream, 4238 bytes
_______________________________________________
Tutor maillist  -  Tutor <at> python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Gmane