tdryer / hangups

the first third-party instant messaging client for Google Hangouts
https://hangups.readthedocs.io/
MIT License
1.71k stars 189 forks source link

hangups macOS 10.13.5 / Python 3.7 #419

Open psonis opened 6 years ago

psonis commented 6 years ago

I get this error when trying to run it on my Mac:

Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.7/bin/hangups", line 7, in from hangups.ui.main import main File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/hangups/init.py", line 6, in from .client import Client File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/hangups/client.py", line 135 self._listen_future = asyncio.async(self._channel.listen()) ^ SyntaxError: invalid syntax

Any clues?

psonis commented 6 years ago

I commented line 135 in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/hangups/client.py and it worked... self._listen_future = asyncio.async(self._channel.listen())

But now I get Login failed (Authorization code cookie not found) when I enter my credentials. I am using a unique app password because I have 2FA enabled.

psonis commented 6 years ago

I managed to log in but now I got a number of errors

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/hangups/ui/__main__.py", line 125, in __init__
    loop.run_until_complete(asyncio.gather(*coros))
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/asyncio/base_events.py", line 568, in run_until_complete
    return future.result()
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/hangups/ui/__main__.py", line 148, in _connect
    yield from self._client.connect()
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/hangups/client.py", line 139, in connect
    yield from self._listen_future
TypeError: 'NoneType' object is not iterable
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.7/bin/hangups", line 11, in <module>
    sys.exit(main())
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/hangups/ui/__main__.py", line 1140, in main
    datetimefmt, notifier_, args.discreet_notifications
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/hangups/ui/__main__.py", line 135, in __init__
    loop.run_until_complete(task)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/asyncio/base_events.py", line 568, in run_until_complete
    return future.result()
concurrent.futures._base.CancelledError
psonis commented 6 years ago

Probably shouldn't have commented the line in the first place...

psonis commented 6 years ago

OK reverted to Python 3.6.x I guess 3.7 isn't fully compatible...

Terrance commented 6 years ago

Deleting arbitrary lines likely won't get you very far...

Regarding the original error: async is a reserved keyword as of 3.7, and asyncio.async (deprecated since Python 3.4) was removed as a result -- this and other instances needs updating to use asyncio.ensure_future instead (hangups requires 3.5+ so this shouldn't be an issue).

3.7 hasn't yet landed on Arch so I've yet to test it, not sure if there are any other breaking changes.

psonis commented 6 years ago

Yes you're right. I do get occasionally crashes with Python 3.6.6 (v3.6.6:4cf1f54eb7) and macOS 10.13.5. Here is the traceback:

 File "/Library/Frameworks/Python.framework/Versions/3.6/bin/hangups", line 11, in <module>
    load_entry_point('hangups==0.4.4', 'console_scripts', 'hangups')()
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/hangups/ui/__main__.py", line 1140, in main
    datetimefmt, notifier_, args.discreet_notifications
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/hangups/ui/__main__.py", line 135, in __init__
    loop.run_until_complete(task)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/asyncio/base_events.py", line 468, in run_until_complete
    return future.result()
concurrent.futures._base.CancelledError
tdryer commented 6 years ago

I just released 0.4.5 which supports Python 3.7.

psonis commented 6 years ago

I just re-installed 3.7 and 0.4.5 but I get this error after logging...

File "/Library/Frameworks/Python.framework/Versions/3.7/bin/hangups", line 11, in <module> load_entry_point('hangups==0.4.5', 'console_scripts', 'hangups')() File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/hangups/ui/__main__.py", line 1140, in main datetimefmt, notifier_, args.discreet_notifications File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/hangups/ui/__main__.py", line 147, in __init__ raise self._exception # pylint: disable=raising-bad-type File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/asyncio/sslproto.py", line 526, in data_received ssldata, appdata = self._sslpipe.feed_ssldata(data) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/asyncio/sslproto.py", line 189, in feed_ssldata self._sslobj.do_handshake() File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/ssl.py", line 763, in do_handshake self._sslobj.do_handshake() ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1045)

tdryer commented 6 years ago

There's a report here that installing openssl fixed that: https://github.com/tdryer/hangups/issues/181#issuecomment-154931621

psonis commented 6 years ago

Well, macOS openssl was the culprit. I removed the "official" Python 3.7 and installed this one brew install python --with-brewed-openssl and it worked.

BUT... after using it for 10-15 minutes, it crashed :( Here's the traceback:

File "/usr/local/bin/hangups", line 11, in <module> sys.exit(main()) File "/usr/local/lib/python3.7/site-packages/hangups/ui/__main__.py", line 1140, in main datetimefmt, notifier_, args.discreet_notifications File "/usr/local/lib/python3.7/site-packages/hangups/ui/__main__.py", line 147, in __init__ raise self._exception # pylint: disable=raising-bad-type File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/asyncio/selector_events.py", line 812, in _read_ready__data_received data = self._sock.recv(self.max_size) OSError: [Errno 65] No route to host