pythonvisual-studio-codepython-asynciopyppeteer

Visual Studio Code doesn´t move to next line usign asyncio and pyppeteer


My goal is to open an browser using pyppeteer and creating a new tab. But Visual Studio stops executing the code after the browser = await launch(headless=False) line. But executing the same code in for Example Thonny does work.

Any Help?

Here is the code (its just an example form the internet):

import asyncio

from pyppeteer import launch
from pyquery import PyQuery as pq

async def main():
    browser = await launch(headless=False)
    page = await browser.newPage()
    await page.goto("http://quotes.toscrape.com/js/")
    doc = pq(await page.content())
    print("Quotes:", doc(".quote").length)
    await browser.close()

asyncio.run(main())```

Solution

  • Here's the result your code run in my project, which opened a blank browser window:

    enter image description here

    Open Command Palette and choose Python: Clear Internal Extension Cache.

    If not help, open a new project, create a new virtual environment and select it as interpreter. See create a virtual environment.