I am getting the following error while calling a built-in function to parse an email in Python.
txt = parser.Parser.parse(fd, headersonly=False)
And the error i got is
TypeError: parse() takes at least 2 arguments (2 given).
Can anybody tell me the way to solve this problem?
This is because
.parse()is an instance method, not a class method.Instead, try
Parser().parse(…)or possibly email.message_from_file/email.message_from_string.