Traceback (most recent call last):
File "/Applications/PyCharm.app/Contents/helpers/pydev/pydevd.py", line 1758, in
main()
File "/Applications/PyCharm.app/Contents/helpers/pydev/pydevd.py", line 1752, in main
globals = debugger.run(setup['file'], None, None, is_module)
File "/Applications/PyCharm.app/Contents/helpers/pydev/pydevd.py", line 1147, in run
pydev_imports.execfile(file, globals, locals) # execute the script
File "/Applications/PyCharm.app/Contents/helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile
exec(compile(contents+"\n", file, 'exec'), glob, loc)
File "/Users/zzg/PycharmProjects/knowgraph/spider/yaojianju/test_yjj.py", line 11, in
asyncio.get_event_loop().run_until_complete(main())
File "/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/asyncio/base_events.py", line 584, in run_until_complete
return future.result()
File "/Users/zzg/PycharmProjects/knowgraph/spider/yaojianju/test_yjj.py", line 6, in main
page = await browser.newPage()
TypeError: 'coroutine' object is not callable
Hi @zeguangzhang , it looks like this project has been abandoned. You may want to consider the active fork pyppeteer2. Feel free to create an issue there if your problem persists with the updated libary.
code is same as readme,and python 3.5 import asyncio from pyppeteer import launch
async def main(): browser = await launch() page = await browser.newPage() await page.goto('http://example.com') await page.screenshot({'path': 'example.png'}) await browser.close() asyncio.get_event_loop().run_until_complete(main())
then run, output content eg blow :
Traceback (most recent call last): File "/Applications/PyCharm.app/Contents/helpers/pydev/pydevd.py", line 1758, in
main()
File "/Applications/PyCharm.app/Contents/helpers/pydev/pydevd.py", line 1752, in main
globals = debugger.run(setup['file'], None, None, is_module)
File "/Applications/PyCharm.app/Contents/helpers/pydev/pydevd.py", line 1147, in run
pydev_imports.execfile(file, globals, locals) # execute the script
File "/Applications/PyCharm.app/Contents/helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile
exec(compile(contents+"\n", file, 'exec'), glob, loc)
File "/Users/zzg/PycharmProjects/knowgraph/spider/yaojianju/test_yjj.py", line 11, in
asyncio.get_event_loop().run_until_complete(main())
File "/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/asyncio/base_events.py", line 584, in run_until_complete
return future.result()
File "/Users/zzg/PycharmProjects/knowgraph/spider/yaojianju/test_yjj.py", line 6, in main
page = await browser.newPage()
TypeError: 'coroutine' object is not callable