Comments (11)
@jettify would you take a look?
from aiomonitor.
Works for me locally, tried your script with nc
:
$ nc localhost 50101
Asyncio Monitor: 1 task running
Type help for available commands
monitor >>> console
Python 3.7.2 (default, Dec 27 2018, 07:35:06)
[Clang 10.0.0 (clang-1000.11.45.5)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
---
This console is running in an asyncio event loop.
It allows you to wait for coroutines using the 'await' syntax.
Try: await asyncio.sleep(1, result=3)
---
>>> import asyncio
>>> await asyncio.sleep(0.1)
>>>
Only difference, I have Python 3.7.2 and macOS
from aiomonitor.
May be clean virtual env can help?
from aiomonitor.
My initial test (above) was done on a Raspberry Pi.
The following tests were all done with fresh virtual envs.
I just did a build from source of python3.7.2 on an AWS Amazon Linux machine. I get the same result:
Task exception was never retrieved
future: <Task finished coro=<handle_connect() done, defined at /home/abc/aiomon372/lib/python3.7/site-packages/aioconsole/server.py:8> exception=AttributeError("'_SpecialForm' object has no attribute 'setdefault'")>
Traceback (most recent call last):
File "/home/abc/aiomon372/lib/python3.7/site-packages/aioconsole/server.py", line 11, in handle_connect
interface = factory(streams=streams)
File "/home/abc/aiomon372/lib/python3.7/site-packages/aiomonitor/utils.py", line 73, in _factory
locals=locals, streams=streams, loop=loop)
File "/home/abc/aiomon372/lib/python3.7/site-packages/aioconsole/code.py", line 56, in __init__
self.locals.setdefault('asyncio', asyncio)
File "/usr/local/lib/python3.7/typing.py", line 698, in __getattr__
return getattr(self.__origin__, attr)
AttributeError: '_SpecialForm' object has no attribute 'setdefault'
Python 3.7.2
aioconsole 0.1.11
aiomonitor 0.3.1
I also tried with Python 3.6.5 on an AWS Amazon Linux machine and get nearly the same result:
Task exception was never retrieved
future: <Task finished coro=<handle_connect() done, defined at /home/abc/aiomon/lib/python3.6/site-packages/aioconsole/server.py:8> exception=AttributeError("'_Union' object has no attribute 'setdefault'",)>
Traceback (most recent call last):
File "/home/abc/aiomon/lib/python3.6/site-packages/aioconsole/server.py", line 11, in handle_connect
interface = factory(streams=streams)
File "/home/abc/aiomon/lib/python3.6/site-packages/aiomonitor/utils.py", line 73, in _factory
locals=locals, streams=streams, loop=loop)
File "/home/abc/aiomon/lib/python3.6/site-packages/aioconsole/code.py", line 56, in __init__
self.locals.setdefault('asyncio', asyncio)
AttributeError: '_Union' object has no attribute 'setdefault'
The difference being the AttributeError
on _Union
versus _SpecialForm
.
Python 3.6.5
aioconsole 0.1.11
aiomonitor 0.3.1
Perhaps a clue is that when I connect with nc when running the Python 3.7.2 test, I see:
$ nc localhost 50101
Asyncio Monitor: 2 tasks running
Type help for commands
monitor >>> ps
+-----------------+----------+----------------------------------------------------------------------------+
| Task ID | State | Task |
+-----------------+----------+----------------------------------------------------------------------------+
| 140306876217288 | PENDING | <Task pending coro=<amain() running at wss6:8> wait_for=<Future pending |
| | | cb=[<TaskWakeupMethWrapper object at 0x7f9bbcd8a1c8>()]> |
| | | cb=[_run_until_complete_cb() at |
| | | /usr/local/lib/python3.7/asyncio/base_events.py:158]> |
| 140306876217448 | FINISHED | <Task finished coro=<start_interactive_server() done, defined at |
| | | /home/abc/aiomon372/lib/python3.7/site-packages/aioconsole/server.py:17> |
| | | result=<Server socke....1', 50102)>]>> |
+-----------------+----------+----------------------------------------------------------------------------+
monitor >>>
Your example only shows one task. I notice that all of my tests (Raspberry Pi with Python 3.7.1, and Python 3.6.5) show two tasks.
from aiomonitor.
Can confirm this.
$ python -V
Python 3.6.6
$ pip freeze
aioconsole==0.1.11
aiomonitor==0.3.1
terminaltables==3.1.0
Clean virtualenv. Investigating.
from aiomonitor.
This issue was introduced in: 0b71c7f#diff-51363086d2299da2efead1b3d155a45bR32 (notice locals assigment) and presents in 0.3.1 release, but not on master. How about make a new year release? (:
from aiomonitor.
I confirm that locals=None
works as a workaround.
as in:
loop = asyncio.get_event_loop()
with aiomonitor.start_monitor(loop, locals=None):
loop.run_until_complete(amain())
from aiomonitor.
I probably contaminated my env with master version, as result failed to repro... Anyway new release should fix things.
from aiomonitor.
Kicked release pipeline https://travis-ci.com/aio-libs/aiomonitor/builds/96348771
from aiomonitor.
New version on PyPI https://pypi.org/project/aiomonitor/0.4.0/
from aiomonitor.
🎉 🎅
from aiomonitor.
Related Issues (20)
- Endless loop after exiting console HOT 12
- v0.4.0 doesn't work on Python 3.5 HOT 10
- Unable to start monitor with already running event loop. HOT 8
- v0.4.1 PyPI release doesn't work (PyPI package differs to Github files) HOT 5
- Traceback on process shutdown HOT 5
- Monitor hangs on context manager exit HOT 5
- Direction key seems not work in the aiomonitor console. HOT 2
- Can't use home / end / arrow keys in console HOT 3
- Add `grep`-wise option on `ps` HOT 3
- Announce: The new maintainer HOT 7
- Follow-ups to #328 HOT 3
- Update the test suite to work HOT 1
- Rewrite the docs
- [TODO] Migrate GHA workflow to use Trusted Publishing HOT 1
- Integration with OpenTelemetry, Prometheus, etc.
- Change the default port numbers to avoid the ephemeral/dynamic range
- Add the read-only mode
- Relax aiohttp dependency HOT 1
- Monitoring of multiple events in one interface HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from aiomonitor.