Hi all,
We have a python program that works with the ibm watson transcriber to transcribe voicemail and send to appropriate staff.
It stopped working on 9/22, for seemingly no reason.
I've tracked down the problem line by printing/logging lines and objects until I found the issue.
The error I'm getting is that "index is out of range", presumably a list is causing the problem. Specifically, the line where the below function tries to obtain the message UID.
So basically there's a for loop which takes the number of new messages in the mailbox, and loops through each one to process each email, like this:
The last line is what I believe is causing the error, but I'm not completely understanding what's going on with the regular expression line, and also why the functions have the [0]'s after them. Forgive me I am still learning. I understand they are lists but I can't exactly figure out what's going wrong here.
Any input is, of course, appreciated.
We have a python program that works with the ibm watson transcriber to transcribe voicemail and send to appropriate staff.
It stopped working on 9/22, for seemingly no reason.
I've tracked down the problem line by printing/logging lines and objects until I found the issue.
The error I'm getting is that "index is out of range", presumably a list is causing the problem. Specifically, the line where the below function tries to obtain the message UID.
So basically there's a for loop which takes the number of new messages in the mailbox, and loops through each one to process each email, like this:
for messageNum in range(numberofMessages): try: processMessage(messagegNum+1)and this is the function processMessage():
def processMessage(messageNum): #assemble message contents raw_message = popServer.retr(messageNum)[1] str_message = email.message_from_bytes(b'\n'.join(raw_message)) body = str(str_message.get_payload()[0]) messageUID = str(popServer.uidl(messageNum)) messageUID = re.findall('UID\d+-\d+,messageUID,0)[0]
The last line is what I believe is causing the error, but I'm not completely understanding what's going on with the regular expression line, and also why the functions have the [0]'s after them. Forgive me I am still learning. I understand they are lists but I can't exactly figure out what's going wrong here.
Any input is, of course, appreciated.