Instance

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • karthikbalaguru

    Instance

    Hi,

    I am new to python. I am trying to use the python files given to me
    for bringing up a setup.
    I get the following error while trying to use a python file -
    AttributeError : Classroom instance has no attribute 'desk_offset'

    How to resolve this ?
    Should i need to define desk_offset to zero in the python file ?

    Any ideas ..

    Thx in advans,
    Karthik Balaguru
  • Jeroen Ruigrok van der Werven

    #2
    Re: Instance

    -On [20080717 09:01], karthikbalaguru (karthikbalagur u79@gmail.com) wrote:
    >AttributeErr or : Classroom instance has no attribute 'desk_offset'
    You are using a Classroom instance and probably assigning something to the
    instance's variable/attribute 'desk_offset'. Except that the class Classroom
    has no self.desk_offse t.

    So in your class definition you would need to add something to __init__()
    like:

    self.desk_offse t = None # or 0 or...

    --
    Jeroen Ruigrok van der Werven <asmodai(-at-)in-nomine.org/ asmodai
    イェルーン ラウフロッ ク ヴァン デル ウェルヴェ ン
    http://www.in-nomine.org/ | http://www.rangaku.org/ | GPG: 2EAC625B
    A frightened mental vortex we will be, a Sun we seek, a Sun we flee...

    Comment

    • Calvin Spealman

      #3
      Re: Instance

      On Thu, Jul 17, 2008 at 2:56 AM, karthikbalaguru
      <karthikbalagur u79@gmail.comwr ote:
      Hi,
      >
      I am new to python. I am trying to use the python files given to me
      for bringing up a setup.
      I get the following error while trying to use a python file -
      AttributeError : Classroom instance has no attribute 'desk_offset'
      >
      How to resolve this ?
      Should i need to define desk_offset to zero in the python file ?
      >
      Any ideas ..
      This means you did something like this:

      class Foo:
      def __init__(self):
      self.bar = 10

      f = Foo()
      print f.quu
      ....
      AttributeError : Foo instance has no attribute 'quu'

      See? You tried to use an attribute that simply doesn't exist. Look in
      the traceback for where you used the desk_offset attribute, and figure
      out why you thought the object had such an attribute and why it does
      not.

      --
      Read my blog! I depend on your acceptance of my opinion! I am interesting!

      Comment

      • karthikbalaguru

        #4
        Re: Instance

        On Jul 17, 5:34 pm, "Calvin Spealman" <ironfro...@gma il.comwrote:
        On Thu, Jul 17, 2008 at 2:56 AM, karthikbalaguru
        >
        <karthikbalagur ...@gmail.comwr ote:
        Hi,
        >
        I am new to python. I am trying to use the python files given to me
        for bringing up a setup.
        I get the following error while trying to use a python file -
        AttributeError : Classroom instance has no attribute 'desk_offset'
        >
        How to resolve this ?
        Should i need to define desk_offset to zero in the python file ?
        >
        Any ideas ..
        >
        This means you did something like this:
        >
        class Foo:
        def __init__(self):
        self.bar = 10
        >
        f = Foo()
        print f.quu
        ...
        AttributeError : Foo instance has no attribute 'quu'
        >
        See? You tried to use an attribute that simply doesn't exist. Look in
        the traceback for where you used the desk_offset attribute, and figure
        out why you thought the object had such an attribute and why it does
        not.
        >
        Thx!! Your ideas were useful.
        I read some basic lessons on python and that were also very helpful in
        solving
        the problem.

        Thx ,
        Karthik Balaguru

        Comment

        Working...