Python marks an instance of my class undefined

Kayode Odeyemi dreyemi at gmail.com
Tue Sep 6 09:02:24 EDT 2011


Is there anything I need to do to create an instance of a class?

I have this simple code(The class is in a package core.fleet):

class Fleet(object):
    def __init__(self):
        """ no-arg constructor """
    def fleet_file_upload(self, filename, type=None):
        if type == 'user':
            return 'photos/%Y/%m/%d'
        return 'images'

    def fleet_get_fleet(self):
        """ Get all fleet """
        return db.db_get_fleet()

    def fleet_get_fleet_type(self):
        """ Get fleet by type or category """

For Python shell, I did this:

>>> import core.fleet
>>> f = Fleet()
Traceback (most recent call last):
  File "<console>", line 1, in <module>
NameError: name 'Fleet' is not defined

What am I doing wrong?


-- 
Odeyemi 'Kayode O.
http://www.sinati.com. t: @charyorde
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20110906/129e23b6/attachment.html>


More information about the Python-list mailing list