Python Forum
Parsing serial data "Attribute Error"
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Parsing serial data "Attribute Error"
#1
I am working on Python 2.7.9 and attempting to parse the serial data. The error I get is AttributeError: 'Serial' object has not attribute 'split'

I am running this on a Pi, and assured that pySerial is installed and updated.

 

import serial

data = serial.Serial("/dev/ttyACM0", 9600)
datasplit = data.split(",")
IR_Data = datasplit [0]

while true:
    print  IR_Data.readline()
Any ideas?
Reply
#2
I assuming you are trying to receive messages. It should look something like this...

import serial
 
data = serial.Serial("/dev/ttyACM0", 9600) #This initialized the connection.

if not data.isOpen()
  data.open()
 

while true:
    readSerial = data.read()
    print(readSerial)
    # code #
When my code doesn't work I don't know why **think** and when my code works I don't know why **think**
Reply
#3
A serial connection is not data, just like a printer is not a piece of paper. You can't split a connection.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Error: audioio has no attribute 'AudioOut' netwrok 3 661 Oct-22-2023, 05:53 PM
Last Post: netwrok
  pyserial/serial "has no attribute 'Serial' " gowb0w 9 4,164 Aug-24-2023, 07:56 AM
Last Post: gowb0w
Video doing data treatment on a file import-parsing a variable EmBeck87 15 2,914 Apr-17-2023, 06:54 PM
Last Post: EmBeck87
  cx_oracle Error - AttributeError: 'function' object has no attribute 'cursor' birajdarmm 1 2,402 Apr-15-2023, 05:17 PM
Last Post: deanhystad
  json api data parsing elvis 0 936 Apr-21-2022, 11:59 PM
Last Post: elvis
  Modify values in XML file by data from text file (without parsing) Paqqno 2 1,703 Apr-13-2022, 06:02 AM
Last Post: Paqqno
  Help reading data from serial RS485 korenron 8 14,047 Nov-14-2021, 06:49 AM
Last Post: korenron
  I need help parsing through data and creating a database using beautiful soup username369 1 1,720 Sep-22-2021, 08:45 PM
Last Post: Larz60+
  Getting 'NoneType' object has no attribute 'find' error when WebScraping with BS Franky77 2 5,286 Aug-17-2021, 05:24 PM
Last Post: Franky77
  Attribute Error received not understood (Please Help) crocolicious 5 2,703 Jun-19-2021, 08:45 PM
Last Post: crocolicious

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020