Comments (7)
You need to change the name of your script from pyppeteer.py as it is "trying to import from itself"
File "pyppeteer.py", line 2, in
from pyppeteer.
I got this on Windows:
D:\xxx\pyppeteer\tests>python test.py
[W:pyppeteer.chromium_downloader] start chromium download.
Download may take a few minutes.
[W:pyppeteer.chromium_downloader] chromium download done.
[W:pyppeteer.chromium_downloader] chromium extracted to: C:\Users\xxx\.pyppeteer\local-chromium\497674
Traceback (most recent call last):
File "test.py", line 15, in <module>
asyncio.get_event_loop().run_until_complete(main())
File "C:\Python36\lib\asyncio\base_events.py", line 467, in run_until_complete
return future.result()
File "test.py", line 13, in main
await browser.close()
File "C:\Python36\lib\site-packages\pyppeteer\browser.py", line 34, in close
asyncio.get_event_loop().run_until_complete(self._connection.dispose())
File "C:\Python36\lib\asyncio\base_events.py", line 454, in run_until_complete
self.run_forever()
File "C:\Python36\lib\asyncio\base_events.py", line 408, in run_forever
raise RuntimeError('This event loop is already running')
RuntimeError: This event loop is already running
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
File "C:\Python36\lib\shutil.py", line 387, in _rmtree_unsafe
os.unlink(fullname)
PermissionError: [WinError 5] Access is denied: 'C:\\Users\\xxx\\.pyppeteer\\.dev_profile\\tmpcml6o4ff\\CrashpadMetrics-active.pma'
it's confusing that I can run the test.py in pyppeteer\tests (and receive above error) but if I make another file with the same content anywhere I got this
> python pyppeteer.py
Traceback (most recent call last):
File "pyppeteer.py", line 6, in <module>
from pyppeteer.launcher import launch
File "D:\xxx\xxx\test\pyppeteer.py", line 6, in <module>
from pyppeteer.launcher import launch
ModuleNotFoundError: No module named 'pyppeteer.launcher'; 'pyppeteer' is not a package
from pyppeteer.
It should be:
'from pyppeteer.launcher import launch'
from pyppeteer.
I've tried that. it failed too.
EDIT: pyppeteer.launcher works but got into another issue:
asyncio.get_event_loop().run_until_complete(main())
File "/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/asyncio/base_events.py", line 467, in run_until_complete
return future.result()
File "pet.py", line 9, in main
await browser.close()
File "/usr/local/scrapy/lib/python3.6/site-packages/pyppeteer/browser.py", line 34, in close
asyncio.get_event_loop().run_until_complete(self._connection.dispose())
File "/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/asyncio/base_events.py", line 454, in run_until_complete
self.run_forever()
File "/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/asyncio/base_events.py", line 408, in run_forever
raise RuntimeError('This event loop is already running')
RuntimeError: This event loop is already running
from pyppeteer.
The line causing the error is await browser.close()
- which I don't really need for my use-case (I run Chrome in a separate Docker container).
from pyppeteer.
I got the same error when installing the pypi version (pip install pyppeteer) but it runs ok when installing the github version.
sudo python3.6 -m pip install -U git+https://github.com/miyakogi/pyppeteer.git@dev
from pyppeteer.
In the latest version, this issue is fixed.
from pyppeteer.
Related Issues (20)
- how to clear the input area?
- Page.cookies() returns List, not Dict HOT 1
- TypeError: 'coroutine' object is not callable, why? HOT 1
- Support ARM OS HOT 1
- Navigation Timeout Exceeded: 30000 ms exceeded HOT 7
- Error browser closes unexpectedly HOT 1
- Can I get innerHTML from the Element Handle Class? HOT 1
- Response.buffer() return str rather than [bytes] HOT 1
- Pyppeteer on python 3.6.8 HOT 1
- UTF-8 characters are coming as garbage HOT 1
- KeyError when send HOT 1
- SyntaxError: invalid escape sequence HOT 2
- Is pyppeteer still maintained? HOT 4
- --enable-automation HOT 1
- can we use the cookies in python request from puppeteer cookies? HOT 1
- Page goto returns None HOT 2
- Execution context was destroyed, most likely because of a navigation. HOT 2
- Is there a forum or something for specific question related to pyppeteer? HOT 1
- Screenshot is not working in headless HOT 1
- >> REPOSITORY ABANDONED >> use pyppeteer2 instead 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 pyppeteer.