I have this example file:
import sys
print(sys.version) # 3.7.1
import asyncio
async def hello_world():
print('Hello World')
asyncio.run(hello_world())
I'm using pipenv to determine the python version to run:
$ pipenv run python --version
Python 3.7.1
Here is the output of running the code using python 3.7.1:
$ pipenv run python ./asyncio.py
3.7.1 (default, Jan 2 2019, 19:26:38)
[Clang 8.0.0 (clang-800.0.42.1)]
3.7.1 (default, Jan 2 2019, 19:26:38)
[Clang 8.0.0 (clang-800.0.42.1)]
Traceback (most recent call last):
File "./asyncio.py", line 18, in <module>
import asyncio
File "/Users/integralist/code/python3.7/asyncio.py", line 23, in <module>
asyncio.run(hello_world())
AttributeError: module 'asyncio' has no attribute 'run'
I'm not sure why python 3.7.1 wouldn't have that run attribute?
I've also tried with python 3.7 but it's the same error?