You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When attempting to run the script, I get the following output:
[nemo@Sailfish ~]$ python sms_import.py --import sms-20181206090639.xml
Traceback (most recent call last):
File "sms_import.py", line 13, in <module>
sms_list = parser.get_all_sms_in_sf_format()
File "/home/nemo/sail_sms.py", line 31, in get_all_sms_in_sf_format
xmldom = minidom.parse(self.xml_file)
File "/usr/lib/python2.7/xml/dom/minidom.py", line 1918, in parse
return expatbuilder.parse(file)
File "/usr/lib/python2.7/xml/dom/expatbuilder.py", line 924, in parse
result = builder.parseFile(fp)
File "/usr/lib/python2.7/xml/dom/expatbuilder.py", line 207, in parseFile
parser.Parse(buffer, 0)
xml.parsers.expat.ExpatError: reference to invalid character number: line 38, column 137
I don't know what xml.parsers.expat.ExpatError is, but I've played with Python before. If you don't want to / don't have time to fix it, could you at least point me in the right direction so I can try?
The text was updated successfully, but these errors were encountered:
I had a similar issue a few minutes ago. You can fix easily - there's an argument for it been a data problem than a bug.
open up the xml file in an editor - I'll go with an editor that shows line numbers and column numbers e.g. visual studio code
search for line 38, and column 137 and most likely simply remove the character in question.
copy the updated file back to your phone and run the script
In my case the issue was emoji that most likely the xml python parser didn't interpret as valid xml code e.g. & #55357;& #56866; for 😢. I ended up just using a regex pattern to replace all such occurrences because I had over 300 such emoji/emoticons in my exported xml file.
Wow. Brilliant - I'll try that out. It never clicked that it could have to do with my export file rather than the python itself. Thank you.
I understand that you believe this should be a data error, not a bug, however a good script would gracefully handle this error, not cut out with cryptic developer messages like this. In a perfect world, this program would explain what you just did to the user to justify the error, or better yet, perform the corrections itself. If I ever get the chance and someone hasn't bet me to it, I'll have a whirl at the latter and see if I can send a pull request.
When attempting to run the script, I get the following output:
I don't know what xml.parsers.expat.ExpatError is, but I've played with Python before. If you don't want to / don't have time to fix it, could you at least point me in the right direction so I can try?
The text was updated successfully, but these errors were encountered: