rpaframework icon indicating copy to clipboard operation
rpaframework copied to clipboard

Error on List Messages in ImapSmtp

Open boanerxe opened this issue 2 years ago • 7 comments

Reopened - this issue was closed by mistake as it was created after July 2023

boanerxe avatar Sep 06 '23 22:09 boanerxe

Hi @boanerxe . Thank you for the report. I can look into that later, but first question is the quotes around "invoice". To me, it doesn't seem to have normal quotes around it, which could cause encoding problem.

your quotes (my quotes above in the message) “invoice”

mikahanninen avatar Sep 07 '23 06:09 mikahanninen

Hi @mikahanninen. Thank you for your answer. The different quotes around invoice are because I also posted this question on the robocorp forum and copied the text from there. For some reason the quotes changed when I posted in the forum, but on Visual Studio I'm using the right quotes. You have a sharp eye for catching that :)

boanerxe avatar Sep 07 '23 07:09 boanerxe

@boanerxe 😄 ok. What is your rpaframework version ?

mikahanninen avatar Sep 07 '23 10:09 mikahanninen

I'm using rpaframework 22.5.3

boanerxe avatar Sep 07 '23 10:09 boanerxe

Can you modify your robot.yaml so that robot is executed with TRACE logging enabled ? and then post the detailed exception message here ?

into the robot.yaml

shell: python -m robot -L TRACE --report NONE --outputdir output --logtitle "Task log" tasks.robot

mikahanninen avatar Sep 07 '23 12:09 mikahanninen

I did, but nothing changed ( I don't get an exception). Also, in the meantime I updated rpaframework to the last version (just in case). Here is the output:

PS C:\Users\Santi\iCloudDrive\Visual Studio Projects>  c:; cd 'c:\Users\Santi\iCloudDrive\Visual Studio Projects'; & 'C:\Users\Santi\AppData\Local\robocorp\temp\8ef8ffe067944b01\rf-ls-run\run_env_00_tozluem4.bat' '-u' 'c:\Users\Santi\.vscode\extensions\robocorp.robotframework-lsp-1.11.0\src\robotframework_debug_adapter\run_robot__main__.py' '--port' '53134' '--no-debug' '--listener=robotframework_debug_adapter.events_listener.EventsListenerV2' '--listener=robotframework_debug_adapter.events_listener.EventsListenerV3' '--pythonpath' 'c:\Users\Santi\iCloudDrive\Visual Studio Projects\rpa_descarga_facturas\.' '--prerunmodifier=robotframework_debug_adapter.prerun_modifiers.FilteringTestsSuiteVisitor' 'c:\Users\Santi\iCloudDrive\Visual Studio Projects\rpa_descarga_facturas\tasks.robot' 
==============================================================================
Tasks :: Este RPA tiene como objetivo descargar todas las facturas generada...
==============================================================================
#1   Buscar facturas en correo                                        | FAIL |
LookupError: unknown encoding: None
------------------------------------------------------------------------------
[ WARN ] Graphviz executable not found: failed to execute ['dot', '-Tsvg'], make sure the Graphviz executables are on your systems' PATH
Tasks :: Este RPA tiene como objetivo descargar todas las facturas... | FAIL |
1 task, 0 passed, 1 failed
==============================================================================
Output:  C:\Users\Santi\iCloudDrive\Visual Studio Projects\output.xml
Log:     C:\Users\Santi\iCloudDrive\Visual Studio Projects\log.html
Report:  C:\Users\Santi\iCloudDrive\Visual Studio Projects\report.html

image

boanerxe avatar Sep 07 '23 14:09 boanerxe

I think I have located the source of the error on the file ImapSmtp.py.

On the function get_decoded_email_body: If the message is not multipart, you are calling the function:

text = str(
                message.get_payload(decode=True),
                content_charset or self.encoding,
                "ignore",
            )

But, if the message is multipart, the function changes to this:

_data = str(payload, str(content_charset), "ignore")

If you change str(content_charset) by content_charset or self.encoding, I stop receiving the error relative to encoding.

@mikahanninen, could you check if this is correct? In that case can you change the code for following versions?

boanerxe avatar Sep 09 '23 22:09 boanerxe