J
jmDesktop
Hi, I have this code (learning from Core Python, Chun's book), module
named chap2.py.
class FooClass(object):
version=0.1
def __init__(self, nm='John Doe'):
self.name=nm
print 'Created a class instance for ', nm
def showname(self):
print 'Your name is', self.name
print 'My name is', self.__class__.__name__
If I do the same think on my Mac OS X 10.5.2
NameError: name 'FooClass' is not defined.
I thought it was the path and did export PATH=$PATH:/mypath/
topythoncode
but it did not help.
What am I doing wrong? Thank you.
named chap2.py.
class FooClass(object):
version=0.1
def __init__(self, nm='John Doe'):
self.name=nm
print 'Created a class instance for ', nm
def showname(self):
print 'Your name is', self.name
print 'My name is', self.__class__.__name__
If I do the same think on my Mac OS X 10.5.2
NameError: name 'FooClass' is not defined.
I thought it was the path and did export PATH=$PATH:/mypath/
topythoncode
but it did not help.
What am I doing wrong? Thank you.