#!/usr/bin/env python3
import logging; logging.basicConfig(level=logging.INFO)
import asyncio, os, json, time
from datetime import datetime
from aiohttp import web
def index(request):
return web.Response(body=b'<h1>Awesome</h1>')
@asyncio.coroutine
def init(loop):
app = web.Application(loop=loop)
app.router.add_route('GET', '/', index)
srv = yield from loop.create_server(app.make_handler(), '127.0.0.1', 9000)
logging.info('server started at http://127.0.0.1:9000...')
return srv
loop = asyncio.get_event_loop()
loop.run_until_complete(init(loop))
loop.run_forever()
流程(28411)开始...... 我(28411)刚刚创建了一个子进程(28412)。 我是孩子的过程(28412),我的父母是28411。 Traceback(最近一次调用最后一次): 文件“webApp.py”,第5行,in 导入asyncio,os,json,时间 文件“/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/asyncio/init.py”,第21行,in Traceback(最近一次调用最后一次): 文件“webApp.py”,第5行,in 导入asyncio,os,json,时间 文件“/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/asyncio/init.py”,第21行,in 来自.base_events import * 文件“/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/asyncio/base_events.py”,第18行,in 来自.base_events import * 文件“/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/asyncio/base_events.py”,第18行,in import concurrent.futures 文件“/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/concurrent/futures/init.py”,第17行,in import concurrent.futures 文件“/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/concurrent/futures/init.py”,第17行,in 来自concurrent.futures.process导入ProcessPoolExecutor 文件“/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/concurrent/futures/process.py”,第54行, 来自concurrent.futures.process导入ProcessPoolExecutor 文件“/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/concurrent/futures/process.py”,第54行, 来自多处理导入SimpleQueue 来自多处理导入SimpleQueue ImportError:无法导入名称'SimpleQueue' ImportError:无法导入名称'SimpleQueue'