When I do:
sam local invoke MyFunction --event events/my_event.json
I get this error:
[ERROR] Runtime.ImportModuleError: Unable to import module 'main': cannot import name 'is_arabic' from 'charset_normalizer.utils' (/var/task/charset_normalizer/utils.py)
Sorry, I am not too familiar with the aws-sam, I have been just using a prior script and it was working fine. Any pointer would be much appreciated. Thank you!
Ok, after a lot of head-scratching, this helped.
In the
requirements.txtI hadrequests==2.31.0earlier. I changed that torequests==2.28.1and now the[ERROR] ... Unable to import module 'main': cannot import name 'is_arabic' from 'charset_normalizer.utils' ...is gone.I still do not get why this fixed the issue, because I think I had
requests==2.31.0earlier and I believe it had worked. However, going through the history of therequirements.txt(+ my notes), I hadrequests==2.28.1much earlier. So I thought of going back torequests==2.28.1and it helped.Again, I do not understand why this fixed the issue. So if someone can shed some light that would be really helpful.
OR, if there is an alternative fix to this issue, kindly post.
Thank you!