KoljaB / Linguflex

Command Your World with Voice
352 stars 41 forks source link

Executing error executing retrieve_email function #3

Closed rakin-rabbi closed 1 year ago

rakin-rabbi commented 1 year ago

Received the error below when retrieving emails from GMAIL IMAP

11:19.9| [openai] Tokens used for functions: 102 11:19.9|Executing function retrieve_emails 11:19.9| [retrieve_emails] Start fetching emails...

11:26.1|------------------------------------------------------------------------------------------------------- 11:26.1| 11:26.1|ERROR: error occurred executing function retrieve_emails: time data 'Fri, 09 Sep 2022 01:43:11 GMT' does not match format '%a, %d %b %Y %H:%M:%S %z' 11:26.1| 11:26.1|-------------------------------------------------------------------------------------------------------

Traceback (most recent call last): File "H:\Lingus\core\linguflex_server.py", line 88, in execute_entity entity_return_value = entity["execution"].from_function_call(request.function_call) File "H:\Lingus\core\linguflex_functions.py", line 160, in from_function_call return self.validate_func(**json.loads(function_call["arguments"])) File "pydantic\decorator.py", line 40, in pydantic.decorator.validate_arguments.validate.wrapper_function File "pydantic\decorator.py", line 134, in pydantic.decorator.ValidatedFunction.call File "pydantic\decorator.py", line 206, in pydantic.decorator.ValidatedFunction.execute File "H:\Lingus\modules/basic\email_imap.py", line 20, in retrieve_emails emails = fetcher.fetch_emails(imap, email_ids) File "H:\Lingus\modules/basic\email_imap_helper.py", line 72, in fetch_emails emails.append(self.parse_email(email_message)) File "H:\Lingus\modules/basic\email_imap_helper.py", line 88, in parse_email date = datetime.strptime(date_str, '%a, %d %b %Y %H:%M:%S %z').strftime('%d.%m.%Y %H:%M:%S') File "C:\Program Files\Python39\lib_strptime.py", line 568, in _strptime_datetime tt, fraction, gmtoff_fraction = _strptime(data_string, format) File "C:\Program Files\Python39\lib_strptime.py", line 349, in _strptime raise ValueError("time data %r does not match format %r" % ValueError: time data 'Fri, 09 Sep 2022 01:43:11 GMT' does not match format '%a, %d %b %Y %H:%M:%S %z'

KoljaB commented 1 year ago

Thanks a lot for your feedback, really appreciate that.

Fixed the date parsing error when fetching emails via IMAP in PR #4 and merged it back to main.

Best regards, Kolja