Hello, I am new to Python, got my first script (that I found online) working. The problem is my PyCharm trail period has expired, so I just installed LiClipse and now my script doesn't work. The script extracts email addresses from your Inbox that's inside a folder:
TypeError: initial_value must be str or None, not bytes
#!/usr/bin/python import imaplib import sys import email import re FOLDER = sys.argv[0] FOLDER = "EMPLOYMENT3" LOGIN = "emailaddresshere" PASSWORD = "passwordhere" IMAP_HOST = "imap.mail.yahoo.com" # Change this according to your provider email_list = [] email_unique = [] mail = imaplib.IMAP4_SSL(IMAP_HOST) mail.login(LOGIN, PASSWORD) mail.select(FOLDER) result, data = mail.search(None, 'ALL') ids = data[0] id_list = ids.split() for i in id_list: typ, data = mail.fetch(i,'(RFC822)') for response_part in data: if isinstance(response_part, tuple): msg = email.message_from_string(response_part[1]) sender = msg['from'].split()[-1] address = re.sub(r'[<>]','',sender) # Ignore any occurences of own email address and add to list if not re.search(r'' + re.escape(LOGIN),address) and not address in email_list: email_list.append(address) print(address)This is the error message I get ever since I switched from PyCharm to LiClipse:
TypeError: initial_value must be str or None, not bytes