Simple import question about mac osx
jmDesktop
needin4mation at gmail.com
Tue Apr 29 13:46:04 EDT 2008
On Apr 29, 1:16 pm, jmDesktop <needin4mat... at gmail.com> wrote:
> 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__
>
> On Windows, if I compile this and then in the python interpreter type:
>
> >>> import chap2
> >>> foo1=FooClass()
>
> Created a class instance for John Doe
>
>
>
> 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.
forgot to say that on the mac I can do import chap2, but when I try
and instantiate I get the error above.
More information about the Python-list
mailing list