wrjlewis Posted May 20, 2020 Author Posted May 20, 2020 20 hours ago, Yourname said: Thanks @wrjlewis! I upgraded and now it's openssl 1.1.1g 21 apr 2020 And here's the new log of errors; [18:30:47.655] Notion Search[Script Filter] Queuing argument 'task' [18:30:47.867] Notion Search[Script Filter] Script with argv '(null)' finished [18:30:47.872] ERROR: Notion Search[Script Filter] Code 1: Traceback (most recent call last): File "notion.py", line 114, in <module> buildNotionSearchQueryData(alfredQuery), headers) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 1053, in request self._send_request(method, url, body, headers) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 1093, in _send_request self.endheaders(body) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 1049, in endheaders self._send_output(message_body) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 893, in _send_output self.send(msg) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 855, in send self.connect() File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 1274, in connect server_hostname=server_hostname) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ssl.py", line 352, in wrap_socket _context=self) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ssl.py", line 579, in __init__ self.do_handshake() File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ssl.py", line 808, in do_handshake self._sslobj.do_handshake() ssl.SSLError: [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:590) Ok that's interesting. Did a bit of research, can you please try this sudo -H pip3.5 install requests[security] Yourname 1
Yourname Posted May 21, 2020 Posted May 21, 2020 18 hours ago, wrjlewis said: sudo -H pip3.5 install requests[security] sudo: pip3.5: command not found @wrjlewis
Yourname Posted May 24, 2020 Posted May 24, 2020 On 5/21/2020 at 9:56 AM, Yourname said: sudo: pip3.5: command not found @wrjlewis After looking around a little @wrjlewis, I was able to install pip and noticed I have pip3.6 and 3.7, so ran your command with both versions. It seems to have installed things on both versions and exited successfully. Yet, I have the same error I pasted earlier.
wrjlewis Posted May 25, 2020 Author Posted May 25, 2020 13 hours ago, Yourname said: After looking around a little @wrjlewis, I was able to install pip and noticed I have pip3.6 and 3.7, so ran your command with both versions. It seems to have installed things on both versions and exited successfully. Yet, I have the same error I pasted earlier. Hmmm. I'm stumped as to why this may be happening still. My knowledge of SSL/TLS doesn't extend this far and without being able to replicate this locally I'm struggling to offer further advice. The stack overflow link I thought was relevant is here. Plenty of possible solutions there, though as I said, without being able to replicate myself I can't tell which solution might help. I would recommend posting this issue on the github repo, perhaps someone else there can provide some further insight.
Yourname Posted May 25, 2020 Posted May 25, 2020 8 hours ago, wrjlewis said: Hmmm. I'm stumped as to why this may be happening still. My knowledge of SSL/TLS doesn't extend this far and without being able to replicate this locally I'm struggling to offer further advice. The stack overflow link I thought was relevant is here. Plenty of possible solutions there, though as I said, without being able to replicate myself I can't tell which solution might help. I would recommend posting this issue on the github repo, perhaps someone else there can provide some further insight. Tried everything from there. The error in alfred though seems to reference python 2.7 even though BASH has 3.7 showing. Which is peculiar. But I give up. Notion is coming up with an API soon, so hopefully then it will work Thanks so much for assistng @wrjlewis!
wrjlewis Posted May 25, 2020 Author Posted May 25, 2020 49 minutes ago, Yourname said: Tried everything from there. The error in alfred though seems to reference python 2.7 even though BASH has 3.7 showing. Which is peculiar. But I give up. Notion is coming up with an API soon, so hopefully then it will work Thanks so much for assistng @wrjlewis! Oh good spot with the python versions being different, I think that is because of the way python is being called through this workflow. I may be able to change that so that it calls python3 if you have it installed rather than defaulting to 2. To check if that’s the issue, do you mind trying the following before you give up entirely! ‘The simplest way would be to add an alias to python3 to always point to the native python installed. Add this line to the .bash_profile file in your $HOME directory at the end. alias python="python3" Doing so makes the changes to be reflected on every interactive shell opened.’
deanishe Posted May 25, 2020 Posted May 25, 2020 1 hour ago, wrjlewis said: The simplest way would be to add an alias to python3 to always point to the native python installed That’s not a great idea, and it won’t work. Generally, it’s expected that python is Python 2 and python3 is Python 3. The two are not particularly compatible, so renaming one to the other can cause issues. It won’t work because Alfred doesn’t use your shell environment because it isn’t started from your shell. Same goes for all Mac apps. If you call python in Alfred, you will get /usr/bin/python, which is Python 2.7. On 5/20/2020 at 9:32 PM, wrjlewis said: sudo -H pip3.5 install requests[security] Also won’t work unless you’ve installed Python 3.5 via Homebrew. Which, as noted above, won’t be called by the workflow. You also shouldn’t be using sudo with Homebrew. 10 hours ago, wrjlewis said: Hmmm. I'm stumped as to why this may be happening still. My knowledge of SSL/TLS doesn't extend this far and without being able to replicate this locally I'm struggling to offer further advice. Users with that problem need to install a newer version of Python via Homebrew and change the Script Filter from python notion.py "{query}" to /usr/local/bin/python notion.py "{query}". Installing Python 3 and using /usr/local/bin/python3 might be a better idea, as your script looks like it will choke on non-ASCII input under Python 2. You should also change the Script Filter to use "with input as argv". "with input as {query}" is tricky to get right, and your escaping options are wrong.
wrjlewis Posted May 25, 2020 Author Posted May 25, 2020 Thanks @deanishe, makes sense re/ python and python3 usage in Alfred versus shell. Still seems to be a mystery why the error is being generated here, yet not for others. Which given what you said, means it’s not a python version issue, at least between 2 and 3, since we’re all using the same python notion.py command.
deanishe Posted May 25, 2020 Posted May 25, 2020 1 minute ago, wrjlewis said: Still seems to be a mystery why the error is being generated here, yet not for others It depends on your macOS version. Apple let macOS’s version of openssl get really out-of-date, and on Sierra and earlier, anything that uses it (like Python) can’t connect to websites with more “modern” SSL configurations.
deanishe Posted May 26, 2020 Posted May 26, 2020 On 5/20/2020 at 12:32 AM, Yourname said: I upgraded and now it's openssl 1.1.1g 21 apr 2020 That doesn't help. The workflow uses the system versions of Python and OpenSSL, not the ones you've installed via Homebrew.
wrjlewis Posted May 26, 2020 Author Posted May 26, 2020 11 hours ago, deanishe said: It depends on your macOS version. Apple let macOS’s version of openssl get really out-of-date, and on Sierra and earlier, anything that uses it (like Python) can’t connect to websites with more “modern” SSL configurations. I'm on macOS Catalina, which ships with OpenSSH_7.9p1, LibreSSL 2.7.3 Could it be @Yourname that you are on an older version of macOS?
deanishe Posted May 26, 2020 Posted May 26, 2020 29 minutes ago, wrjlewis said: OpenSSH_7.9p1 SSH != SSL.
wrjlewis Posted May 26, 2020 Author Posted May 26, 2020 10 minutes ago, deanishe said: SSH != SSL. Is there a better way of finding out which version of ssl I have? Is it not libressl 2.7.3?
deanishe Posted May 26, 2020 Posted May 26, 2020 2 hours ago, wrjlewis said: Is it not libressl 2.7.3? Sounds about right, yes. Apple switched to LibreSSL.
Yourname Posted May 28, 2020 Posted May 28, 2020 Hi @wrjlewis and @deanishe, sorry just saw this! I haven't made an alias of python because I saw somewhere a few days ago pretty much what @deanishe said (in much more complicated terms haha) I'm on Sierra 10.12.6 and this is my current PATH: MacBook-Pro-5:~ xyz$ echo $PATH /usr/local/opt/openssl@1.1/bin:/Library/Frameworks/Python.framework/Versions/3.6/bin:/usr/local/opt/openssl/bin:/usr/local/opt/python/libexec/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/usr/local/heroku:/usr/local/heroku/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin
deanishe Posted May 28, 2020 Posted May 28, 2020 2 minutes ago, Yourname said: I'm on Sierra 10.12.6 and this is my current PATH Your shell’s PATH doesn’t matter because Alfred doesn’t use it. Mac applications aren't launched from your shell. You need to find a version of Python that is linked with a recent version of OpenSSL (or LibreSSL), and edit the workflow to use that instead.
wrjlewis Posted May 29, 2020 Author Posted May 29, 2020 @Yourname Is upgrading your mac os an option? It sounds like that would come with an updated version of OpenSSL or LibreSSL, and you wouldn't have to edit the workflow at all.
Yourname Posted May 29, 2020 Posted May 29, 2020 So, @deanishe and @wrjlewis, looks like @deanishe's suggestion moved us into a new (and shorter) error. I updated the command to: /usr/local/bin/python3.7 notion.py "{query}" I even tried /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 notion.py "{query}" [16:47:43.582] Logging Started... [16:47:45.922] Notion Search[Script Filter] Queuing argument 'y' [16:47:46.038] Notion Search[Script Filter] Script with argv '(null)' finished [16:47:46.043] ERROR: Notion Search[Script Filter] Code 1: Traceback (most recent call last): File "notion.py", line 3, in <module> import httplib, urllib ModuleNotFoundError: No module named 'httplib'
deanishe Posted May 30, 2020 Posted May 30, 2020 (edited) httplib is Python 2. It has been renamed in Python 3. Try /usr/local/bin/python or /usr/local/bin/python2 instead. Edited May 31, 2020 by deanishe Fix formatting
Yourname Posted May 31, 2020 Posted May 31, 2020 On 5/29/2020 at 9:07 PM, deanishe said: httplib is Python 2. It has been renamed in Python 3. Try /usr/local/binpythonor/usr/local/bin/python2` instead. Couldn't find 2 in /local/bin, so ended up trying /usr/bin/python2.7 (the nearest one to what you asked, and I had available) and it worked!!!!!! Thanks soooooo much @deanishe!!!! Thank you so much for writing this and helping me figure out @wrjlewis!! wrjlewis 1
deanishe Posted May 31, 2020 Posted May 31, 2020 11 hours ago, Yourname said: /usr/bin/python2.7 […] worked!!!!!! Uh, well that’s entirely unexpected. That’s supposed to be just a different name for /usr/bin/python, which isn’t working… But if it's working, that's all that matters. Yourname 1
joeynotjoe Posted June 18, 2020 Posted June 18, 2020 Wow, @wrjlewis this rules! Thank you for the workflow, I wish I would have paid attention sooner! I have one question- and let me know if I should open an issue on GitHub for this if it makes sense- I use a lot of custom icons for my pages, and thus- I see a lot of lengthy image URLs in my results (finding the correct results - it just doesn't look "pretty"). Is there some way of handling non-native emojis?
wrjlewis Posted June 18, 2020 Author Posted June 18, 2020 17 minutes ago, joeynotjoe said: Wow, @wrjlewis this rules! Thank you for the workflow, I wish I would have paid attention sooner! I have one question- and let me know if I should open an issue on GitHub for this if it makes sense- I use a lot of custom icons for my pages, and thus- I see a lot of lengthy image URLs in my results (finding the correct results - it just doesn't look "pretty"). Is there some way of handling non-native emojis? Hey Glad you like it! If you could raise an issue that would be a great way to track this. When I get time I can take a proper look. At first glance I'm inclined to say that Notion will not be able to display a non-native emoji, it looks like they are stored as jpgs within notion which I think can not be displayed in an Alfred search result. But I could be totally wrong - will need to check. At the very least I could remove the 'ugly' URL so the results look cleaner when searching. Thanks!
joeynotjoe Posted June 18, 2020 Posted June 18, 2020 Awesome, will do! Appreciate the speedy reply I can't think of any way to display the custom icon URL either, unless it was somehow able to take over for the default Notion icon? 🤔 Either way, I'll open an issue, and if you ever have the time to check it out, that'd be awesome- but as it stands, it's still immensely useful. Take care!
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now