Code Monkey home page Code Monkey logo

Comments (7)

 avatar commented on September 21, 2024 4

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.

deathemperor avatar deathemperor commented on September 21, 2024 1

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.

Roger535 avatar Roger535 commented on September 21, 2024

It should be:
'from pyppeteer.launcher import launch'

from pyppeteer.

deathemperor avatar deathemperor commented on September 21, 2024

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.

dimitry12 avatar dimitry12 commented on September 21, 2024

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.

Zulko avatar Zulko commented on September 21, 2024

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.

miyakogi avatar miyakogi commented on September 21, 2024

In the latest version, this issue is fixed.

from pyppeteer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.