Feb-06-2018, 02:45 AM
Hi all,
I received an exception
So may I know where the issue locates?
Best Regards,
Henry
I received an exception
UnicodeEncodeError: 'UCS-2' codec can't encode characters in position 34-34: Non-BMP character not supported in TkSo I try to use the statement "try...except...else" to skip the exception, below is an example:
for repo_dict in repo_dicts: try: descr=repo_dict['description'] except UnicodeEncodeError: descr='EncodeError' else: print('\nName:',repo_dict['name']) print('Owner:',repo_dict['owner']['login']) print('Stars:',repo_dict['stargazers_count']) print('Repository:',repo_dict['html_url']) print('Created:',repo_dict['created_at']) print('Updated:',repo_dict['updated_at']) print('Description:',descr)The results I expected should be it will print out "EncodeError" if the repo_dict['descripton'] has UnicodeEncodeError, but it changes nothing...
So may I know where the issue locates?
Best Regards,
Henry