I am completely new to Python and are trying to learn by following some examples: Best way for me to learn is by looking at examples and trying to understand and make use of code that I need myself.
I am currently trying to learn python by working on a project with Raspberry Pi Zero W and an adafruit fona 808 breakout board.
However, the example code was made for Python 2.7 and I want to convert it to work for Python 3.
I am getting this TypeError. Question is, how should the if be done to work. I have tried searching google and reading up on it, but unfortunately I don't really understand what is wrong.
Is there anyone who can please explain to me what is actually wrong with this piece of code, and how it should be written to work. If you also could pass me a link with references where I could read up on the functions I would be really happy. :)
Thanks!
The actual error:
if "secondary DNS address" not in output1 and "locked" not in output1:
TypeError: a bytes-like object is required, not 'str'
The relevant code:
import I2C_LCD_driver
import socket
import fcntl
import struct
from os import system
import serial
import subprocess
from time import sleep
from ISStreamer.Streamer import Streamer
....
....
output1 = subprocess.check_output("cat /var/log/syslog | grep pppd | tail -1", shell=True)
if "secondary DNS address" not in output1 and "locked" not in output1: