Cannot run concurrent activities diagram python

Answered

getting error: `TypeError: isinstance() arg 2 must be a type or tuple of types`


```

import asyncio
async def run_a(i):
print('starting', i)
await asyncio.sleep(3)
print('done', i)


async def run():
jobs = []
for i in range(1000):
jobs.append(run_a(i))
await asyncio.wait(jobs)


loop = asyncio.get_event_loop()
loop.run_until_complete(run())
loop.run_forever()

```

 

traceback:
```
Traceback (most recent call last):
File "/home/alairock/.IntelliJIdea2019.2/config/plugins/python/helpers/pydev/pydevd.py", line 2060, in <module>
main()
File "/home/alairock/.IntelliJIdea2019.2/config/plugins/python/helpers/pydev/pydevd.py", line 2054, in main
globals = debugger.run(setup['file'], None, None, is_module)
File "/home/alairock/.IntelliJIdea2019.2/config/plugins/python/helpers/pydev/pydevd.py", line 1405, in run
return self._exec(is_module, entry_point_fn, module_name, file, globals, locals)
File "/home/alairock/.IntelliJIdea2019.2/config/plugins/python/helpers/pydev/pydevd.py", line 1412, in _exec
pydev_imports.execfile(file, globals, locals) # execute the script
File "/home/alairock/.IntelliJIdea2019.2/config/plugins/python/helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile
exec(compile(contents+"\n", file, 'exec'), glob, loc)
File "/home/alairock/dev/CanopyCode/canesis/restream_test.py", line 62, in <module>
loop.run_until_complete(run())
File "/usr/lib/python3.7/asyncio/base_events.py", line 571, in run_until_complete
self.run_forever()
File "/usr/lib/python3.7/asyncio/base_events.py", line 539, in run_forever
self._run_once()
File "/usr/lib/python3.7/asyncio/base_events.py", line 1771, in _run_once
_format_handle(handle), dt)
File "/usr/lib/python3.7/asyncio/base_events.py", line 72, in _format_handle
if isinstance(getattr(cb, '__self__', None), tasks.Task):
TypeError: isinstance() arg 2 must be a type or tuple of types
Exception ignored in: <module 'threading' from '/usr/lib/python3.7/threading.py'>
Traceback (most recent call last):
File "/usr/lib/python3.7/threading.py", line 1281, in _shutdown
t.join()
File "/usr/lib/python3.7/threading.py", line 1032, in join
self._wait_for_tstate_lock()
File "/usr/lib/python3.7/threading.py", line 1048, in _wait_for_tstate_lock
elif lock.acquire(block, timeout):
KeyboardInterrupt:
```

0
2 comments
Avatar
Permanently deleted user
0

Hi,

Unfortunately, the issue is known https://youtrack.jetbrains.com/issue/PY-34190, please feel free to upvote and leave comments.

0

Please sign in to leave a comment.