03-01-2018 07:31 AM - edited 03-19-2019 01:11 PM
Hello,
I'm trying to use the DevNet python script to download my chat transcripts from SocialMiner. I've installed Python 2.7.14 (with the requests modules pre-installed, as per the documentation says). The problem is when I execute the command "pythong 'filename.py' --host <socialminer ip> --user <username> --password <password>", I keep getting the following error:
Traceback (most recent call last):
File "filename.py'", line 189, in <module>
main()
File "filename.py'", line 169, in main
root = ElementTree.fromstring(search_response)
File "C:\Python27\lib\xml\etree\ElementTree.py", line 1311, in XML
parser.feed(text)
File "C:\Python27\lib\xml\etree\ElementTree.py", line 1657, in feed
self._parser.Parse(data, 0)
UnicodeEncodeError: 'ascii' codec can't encode character u'\xbf' in position 2367: ordinal not in range(128)
Has anyone went through the same error?
URL of the script: https://devs.cisco.com/fileMedia/download/6ac1fce1-4a3a-4fa3-a22f-e91de859a7af
I also attached the "ElementTree.py" that is getting called by the main script. Keep in mind that I changed it to 'txt' because of the upload page requeriments.
03-07-2018 12:50 PM
Hi Martin,
Oops, but good catch!
Basically, the bulk transcript downloader script is unable to process unicode (UTF-8 encoded) characters. (Do your transcripts have multi-byte, non-english characters in them?)
It is a simple fix, I will do it and re-publish this code.
Meanwhile, can you try one of these options?
export PYTHONIOENCODING="UTF-8"Then, in the same shell, run the python script again.
export LC_ALL=C.UTF-8Then, in the same shell, run the python script again.
FYI, all the sample code of SocialMiner (including this one) is available publicly on github.com now! Check out https://github.com/CiscoDevNet/socialminer-sample-code
Hope this helps. Let me know.
Thanks,
Nagendra U M
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide