Skip to content
This repository has been archived by the owner on Mar 22, 2021. It is now read-only.

TypeError: object of type 'NoneType' has no len() #18

Open
JoesphG opened this issue Jul 15, 2018 · 3 comments
Open

TypeError: object of type 'NoneType' has no len() #18

JoesphG opened this issue Jul 15, 2018 · 3 comments

Comments

@JoesphG
Copy link

JoesphG commented Jul 15, 2018

Hi all, any ideas as to resolving this problem?

C:\sms\hangouts_to_sms-develop>python` hangouts_to_sms.py
Parsing Hangouts data file...
Done.
Converting to SMS export file...
Error: could not match sender gaia ID to participant IDs!
Error: could not match sender gaia ID to participant IDs!
Error: could not match sender gaia ID to participant IDs!
Error: could not match sender gaia ID to participant IDs!
Error: could not match sender gaia ID to participant IDs!
Error: could not match sender gaia ID to participant IDs!
Error: could not match sender gaia ID to participant IDs!
Error: could not match sender gaia ID to participant IDs!
Traceback (most recent call last):
  File "hangouts_to_sms.py", line 18, in <module>
    titanium_output.create_output_file(conversations, self_gaia_id, OUTPUT_FILE)
  File "C:\sms\hangouts_to_sms-develop\titanium_backup_formatter.py", line 74, in create_output_file
    content_is_plain = self._is_ascii(message.content)
  File "C:\sms\hangouts_to_sms-develop\titanium_backup_formatter.py", line 176, in _is_ascii
    return len(text) == len(text.encode())
TypeError: object of type 'NoneType' has no len()
@JoesphG
Copy link
Author

JoesphG commented Jul 20, 2018

had looked at the suggestions in #12 but still unable to resolve @mrdehate

@chadwilcomb
Copy link

@JoesphG I was stuck in the same place you were and got through by applying the following additional steps:

  1. Adding a null check to the _is_ascii function at line 174-6 of titanium_backup_formatter.py
def _is_ascii(text):
    # Returns true if the text in not None and only contains ASCII characters
    return text and len(text) == len(text.encode())
  1. Remove any empty <sms> tags from output XML (by searching for ></sms>)

@JoesphG
Copy link
Author

JoesphG commented Oct 17, 2018

Thanks Ill give it a go and see if that resolves

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants