"getaddrinfo() argument 1 must be string or None " error after call this code

213 views Asked by At
import imaplib, email
        with open('Accounts.txt', 'r') as f:
            data = f.readline()[1:]    
        user, password = data.split(':')
        with open(b'serverimap.txt', 'r') as good:
            serverss = good.readlines()  
        mail = imaplib.IMAP4_SSL(serverss, 993)
        mail.login(user, password)
        print("logged")
        mail.select("INBOX", "Junk")

i get error "getaddrinfo() argument 1 must be string or None " error after call this code my account and imap server in txt files

1

There are 1 answers

3
Mark On

readlines() returns a list - and apparently IMAP4_SSL() is looking for a string. Consider changing readlines() to just read().

serverss = good.read()