AttributeError: type object 'object' has no attribute '__getattr__' (Ubilinux)

672 Views Asked by At

I'm working on a project with the Intel Edison and Mini Breakout Board with Ubilinux and when trying commend: python uart.py I get:

root@ubilinux:~# python uart.py
Traceback (most recent call last):
File "uart.py", line 7, in <module>
u.setBaudRate(115200)
File "/usr/local/lib/i386-linux-gnu/python2.7/site-packages/mraa.py", line 1355, in <lambda>
    __getattr__ = lambda self, name: _swig_getattr(self, Uart, name)
File "/usr/local/lib/i386-linux-gnu/python2.7/site-packages/mraa.py", line 78, in _swig_getattr
    return _swig_getattr_nondynamic(self, class_type, name, 0)
File "/usr/local/lib/i386-linux-gnu/python2.7/site-packages/mraa.py", line 73, in _swig_getattr_nondynamic
    return object.__getattr__(self, name)
AttributeError: type object 'object' has no attribute '__getattr__'

And here is the Python code:

import mraa

# Initialize UART
u=mraa.Uart(0)

# Set UART parameters
u.setBaudRate(115200)
u.setMode(8, mraa.UART_PARITY_NONE, 1)
u.setFlowcontrol(False, False)

# Start a neverending loop waiting for data to arrive.
# Press Ctrl+C to get out of it.
while True:
  if u.dataAvailable():
    # We are doing 1-byte reads here
    data_byte = u.readStr(1)
    print(data_byte)
    # Just a two-way half-duplex communication example, "X" is a flag
    if data_byte == "X":
      u.writeStr("Yes, master!")

Can someone please help me fix this issue?

Thanks in advance

0

There are 0 best solutions below