Open UstedLoco opened 2 years ago
Hi there, are you using Python 2.x or Python 3.x?
Hi Christopher, thanks for replying. I’m using Python 3.9.
Hey, just following up on this. Any chance you could advise?
The code is written for python 2. If you want to use python 3, you'll need to update the code or use a fork of the code that someone has already updated.
https://github.com/samling/smsxml2html looks like it may work for python 3
Alternatively, my fork: https://github.com/ackermanaviation/smsxml2html also works with python 3. But I've made more changes to fix some bugs, With more changes, it's also more likely I've broken something. It hasn't been tested outside of my personal files.
Thanks for the reply! Tried both of your suggestions, they both give me this error:
Traceback (most recent call last):
File "D:\sms\smsxml2html.py", line 244, in <module>
main()
File "D:\sms\smsxml2html.py", line 238, in main
files = dumpConversations(args.output, conversations, carrier_number)
File "D:\sms\smsxml2html.py", line 192, in dumpConversations
f.write('<td><b><span class="msg_date">%s</span></td><td><span class="msg_sender_%s">%s %s</span></b></td><td>%s' % (dt.strftime('%m/%d/%y %I:%M:%S%p'), msg.type_, '<<' if msg.type_ == "1" else '>>', (msg.contact_name if msg.contact_name is not None else address) if msg.type_ == "1" else "You", msg.text))
File "C:\Users\J\AppData\Local\Programs\Python\Python39\lib\encodings\cp1252.py", line 19, in encode
return codecs.charmap_encode(input,self.errors,encoding_table)[0]
UnicodeEncodeError: 'charmap' codec can't encode characters in position 118-119: character maps to <undefined>
Looks like I sorted it by adding the encoding parameter to
with open(output_path, 'w', encoding="utf-8") as f:
It now outputs the html files. This is with the Samling one but I suspect it would be the same with yours.
Hello, I hope this is the right place for this. I don't know much about Github or Python.
I attempted to run this on an couple of existing xml backups I have. I get the following:
Is this possible to remedy and get it to work? Thank you