Python API throwing Error
Thanks for filing an issue! Please answer the questions below so I can help you.
- iTerm2 version: Build 3.3.9
- OS version: MacOS Catalina 10.15.4
- Attach com.googlecode.iterm2.plist
- Debug Log: debuglog.txt
- Are you reporting a performance issue, excessive CPU usage, or a hang? No
- Are you reporting a crash? No
- Are you reporting excessive memory usage? No
Detailed steps to reproduce the problem:
- Clone the repository at https://github.com/kamranahmedse/itomate
- Run
make setup
- Run
. ./venv/bin/activate
- Run
pip install --upgrade setuptools --force-reinstall wheel twine iterm2 pyyaml PyObjC PyObjC-core
- Install the app using
make install
- Now run
itomate --version
it will throw the error:
There was a problem connecting to iTerm2.
Please check the following:
* Ensure the Python API is enabled in iTerm2's preferences
* Ensure iTerm2 is running
* Ensure script is running on the same machine as iTerm2
If you'd prefer to retry connecting automatically instead of
raising an exception, pass retry=true to run_until_complete()
or run_forever()
Traceback (most recent call last):
File "/usr/local/bin/itomate", line 11, in <module>
load_entry_point('itomate', 'console_scripts', 'itomate')()
File "/Users/kamranahmed/Workspace/itomate/itomate/itomate.py", line 194, in main
iterm2.run_until_complete(activate)
File "/usr/local/lib/python3.7/site-packages/iterm2/connection.py", line 471, in run_until_complete
return Connection().run_until_complete(coro, retry, debug)
File "/usr/local/lib/python3.7/site-packages/iterm2/connection.py", line 143, in run_until_complete
return self.run(False, coro, retry, debug)
File "/usr/local/lib/python3.7/site-packages/iterm2/connection.py", line 228, in run
return loop.run_until_complete(self.async_connect(async_main, retry))
File "/usr/local/Cellar/python/3.7.7/Frameworks/Python.framework/Versions/3.7/lib/python3.7/asyncio/base_events.py", line 587, in run_until_complete
return future.result()
File "/usr/local/lib/python3.7/site-packages/iterm2/connection.py", line 384, in async_connect
async with self._get_connect_coro() as websocket:
File "/usr/local/lib/python3.7/site-packages/websockets/client.py", line 517, in __aenter__
return await self
File "/usr/local/lib/python3.7/site-packages/websockets/client.py", line 535, in __await_impl__
transport, protocol = await self._create_connection()
File "/usr/local/Cellar/python/3.7.7/Frameworks/Python.framework/Versions/3.7/lib/python3.7/asyncio/unix_events.py", line 232, in create_unix_connection
await self.sock_connect(sock, path)
File "/usr/local/Cellar/python/3.7.7/Frameworks/Python.framework/Versions/3.7/lib/python3.7/asyncio/selector_events.py", line 473, in sock_connect
return await fut
File "/usr/local/Cellar/python/3.7.7/Frameworks/Python.framework/Versions/3.7/lib/python3.7/asyncio/selector_events.py", line 478, in _sock_connect
sock.connect(address)
FileNotFoundError: [Errno 2] No such file or directory
What happened: iTerm API was working fine before and it suddenly stopped and throwing the error given above.
What should have happened:
Running the command itomate --version
should have connected to iterm and printed the app version.