kevin-funderburg / alfred-microsoft-onenote-navigator

Use Alfred to browse through your Microsoft OneNote notebooks, section groups and sections and then jump to them instantly.
Other
69 stars 6 forks source link

'ascii' codec can't encode characters in position 0-3: ordinal not in range(128) #15

Open jqzhangd opened 3 years ago

jqzhangd commented 3 years ago

Hello, Kevin. Run the program to report an error:'ascii' codec can't encode characters in position 0-3: ordinal not in range(128)

alfred 4 How should I solve it?Tanks!

pmmxd commented 3 years ago

Hello, Kevin. Run the program to report an error:'ascii' codec can't encode characters in position 0-3: ordinal not in range(128) image

Ronaltn commented 3 years ago

Me too, how to solve

MrConnorKenway commented 3 years ago

Temporary workaround:

--- a/notebook_item.py
+++ b/notebook_item.py
@@ -72,7 +72,7 @@ class NotebookItem:

     def set_url(self):
         if self.Type == 4:
-            self.url = 'onenote:https://d.docs.live.net/{0}/Documents/{1}'.format(get_user_uid(), self.Title)
+            self.url = 'onenote:https://d.docs.live.net/{0}/Documents/{1}'.format(get_user_uid(), self.Title.encode('utf-8'))
         else:
             self.url = 'onenote:#page-id={0}&end'.format(self.GUID)
hieutran-coder commented 3 years ago

Hi, I have same error, I don't know python so I don't understand what that mean. Can you explain more clearly what have to do?

scramjetFoam commented 3 years ago

Hello, Kevin. Run the program to report an error:'ascii' codec can't encode characters in position 0-3: ordinal not in range(128)

alfred 4 How should I solve it?Tanks!

Acsii错误,好像是因为不支持中文搜索

在getNotebooks.py文件,第七行import sys后添加:

reload(sys) sys.setdefaultencoding('utf-8')

即可

scramjetFoam commented 3 years ago

Hello, Kevin. Run the program to report an error:'ascii' codec can't encode characters in position 0-3: ordinal not in range(128) image

Acsii错误,好像是因为不支持中文搜索

在getNotebooks.py文件,第七行import sys后添加:

reload(sys) sys.setdefaultencoding('utf-8')

即可

mskarka commented 1 year ago
a/notebook_item

Thank you for your answer. I am not a programmer so I had a big issues in implementing that. But I was successful. So to summary what I done to make OneNote Navigagotr to work in 2022 on M1 Macbook Pro:

Install Python 2 with this guide: https://www.alfredapp.com/help/kb/install-dependencies/ Install edited workflow from this repository:https://github.com/alfredapp/updated-third-party-python2-workflows#workflows Install Code Editor (I choosed Atom) Opened "notebook_item.py" at workflow file path Locate row 75 and edit it so it looks like your suggestion

MrConnorKenway commented 1 year ago
a/notebook_item

Thank you for your answer. I am not a programmer so I had a big issues in implementing that. But I was successful. So to summary what I done to make OneNote Navigagotr to work in 2022 on M1 Macbook Pro:

Install Python 2 with this guide: Install edited workflow from this repository: Install Code Editor (I choosed Atom) Opened "notebook_item.py" at workflow file path Locate row 75 and edit it so it looks like your suggestion

Thank you for your detailed additional explanation. My bad to treat others like programmers.