1

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

Ziomix
  • 11
  • 2
  • 1
    Ah, no, that's a bug in SWIG, not something that the mraa maintainers can help with. It was fixed in 3.0.9. – Martijn Pieters Oct 29 '17 at 13:21
  • I use Ublilinux and it's embedded Linux based on Debian 7.11, so it's Debian "wheezy" and I can't upgrade SWIG to 3.0.9. – Ziomix Oct 29 '17 at 17:55
  • Well, the bug is only with the error report; there is still an issue with the attribute not existing. That's not something I can help with; it could be an issue with your local installation. I have no experience with the `mraa` library. – Martijn Pieters Oct 30 '17 at 10:48
  • I resolve the problem. I installed Yocto Project instead of Ubilinux. – Ziomix Nov 25 '17 at 15:42

0 Answers0