Home.Verilog.Digital Design.Digital Basics.Python.RF Basics.
Custom Search

Legal Disclaimer

Chip Designing for ASIC/ FPGA Design engineers and Students
Digital-logic Design...  Dream for many students… start learning front-end…

Legal Disclaimer

@TYH :- 4G LTE Long Term Evolution Tutorial, CloudComputing
Verilog Tutorial.
Get Noticed:- Submit your own content to be published on fullchipdesign.com

Send it to fullchip@gmail.com

Digital Basics Tutorial.
File read operations.

Class & global var.

File write op's.

Glob module.

Conditional stms.

String 2 hex.

UNIX in Python.

Diamond Pattern.

TypeError - arg.

TyprError - str.

TypeError - strconv.


Function call.

Read bin files.

AttributeError:  ** instance has no attribute **

Lets run following code to generate the error

import sys
class tables:
   def __init__(self,w):
       # 2.4 Definitions of tables for the FSM
       ans = self.T0_r(w)
       print "Result = %s" % (ans)
    def T0_r(self, w):
       self.w = w
       self.s1_t0_r = self.T0[self.w]
       return self.s1_t0_r
    def tables_ls(self):    
        self.T0 = ['0xFF563C6' ,'0x84FF7CF8' ,'0x897788EE' ,'0x8EFB7BF6',
               '0xFE2F2FF ' ,'0xBCAF6BD6' ,'0xAA6F6FDE' ,'0xFFC5C591']

def main ():
   # Read 0 elemant of the table array by calling class
   y = tables(0x4)


Python common error messages - AttributeError


Traceback (most recent call last):
 File "calling_classes.py", line 28, in ?
 File "calling_classes.py", line 26, in main
   y = tables(0x4)
 File "calling_classes.py", line 11, in __init__
   ans = self.T0_r(w)
 File "calling_classes.py", line 17, in T0_r
   self.s1_t0_r = self.T0[self.w]
AttributeError: tables instance has no attribute 'T0'


Check the corrected code to fix the AttributeError