0

I want to use pyserial to control Ubuntu OS reboot and I need to get and read the information until to the login in the txt.

I use this code:

logging.basicConfig(filename='onoff.txt',format='%(asctime)s %(message)s', datefmt='%m/%d/%Y %I:%M:%S %p')
logging.warning(ser.readline())

But the ser.readline in the txt only have the one line , I need all information in the txt.

Is it possible read all information and write in the txt file?

Thanks!!

Michael Butscher
  • 10,028
  • 4
  • 24
  • 25
Lu儒
  • 3
  • 4

1 Answers1

0

If you just want to individually log all the lines in the file, you can do:

for line in ser:
    logging.warning(line)
mxbi
  • 853
  • 6
  • 25