• 22-Jan-2023
Lightrun Team
Author Lightrun Team
This article is about fixing error when PermissionError: [WinError 5] Access is denied in PSF Requests-HTML

Error when PermissionError: [WinError 5] Access is denied in PSF Requests-HTML

Lightrun Team
Lightrun Team

Explanation of the problem

When using the script to scrape a webpage using the requests_html library, the following error message is encountered:

Traceback (most recent call last): File “C:/Users/Nick/gfddfsf.py”, line 9, in <module> url.html.render() File “C:\Users\Nick\lib\site-packages\requests_html.py”, line 572, in render self.session.browser # Automatycally create a event loop and browser File “C:\Users\Nick\lib\site-packages\requests_html.py”, line 680, in browser self._browser = self.loop.run_until_complete(pyppeteer.launch(headless=True, args=[‘–no-sandbox’])) File “C:\Users\Nick\lib\asyncio\base_events.py”, line 467, in run_until_complete return future.result() File “C:\Users\Nick\lib\site-packages\pyppeteer\launcher.py”, line 311, in launch return await Launcher(options, **kwargs).launch() File “C:\Users\Nick\lib\site-packages\pyppeteer\launcher.py”, line 169, in launch **options, File “C:\Users\Nick\lib\subprocess.py”, line 709, in init restore_signals, start_new_session) File “C:\Users\Nick\lib\subprocess.py”, line 997, in _execute_child startupinfo) PermissionError: [WinError 5] Access is denied

This error occurs when the script is trying to create a browser using pyppeteer. The error message suggests that the script does not have the necessary permissions to create a new process. One potential solution could

Troubleshooting with the Lightrun Developer Observability Platform

Getting a sense of what’s actually happening inside a live application is a frustrating experience, one that relies mostly on querying and observing whatever logs were written during development.
Lightrun is a Developer Observability Platform, allowing developers to add telemetry to live applications in real-time, on-demand, and right from the IDE.

  • Instantly add logs to, set metrics in, and take snapshots of live applications
  • Insights delivered straight to your IDE or CLI
  • Works where you do: dev, QA, staging, CI/CD, and production

Start for free today

Problem solution for error when PermissionError: [WinError 5] Access is denied in PSF Requests-HTML

When using the PSF (Python Software Foundation) library requests-html, a PermissionError with the message “Access is denied” may occur when attempting to use the .render() function. This issue is typically encountered on Windows operating systems and is caused by a problem with the execution of the child process, as indicated by the error message.

One potential solution to this issue is to include the argument ‘–no-sandbox’ when initializing the browser, as demonstrated in the following code snippet:

session = HTMLSession()
url = session.get(link)

This argument disables the default security feature of the browser, and allows it to run without the restrictions imposed by the sandbox.

Another possible solution is to run the script as an administrator, which gives the script the necessary permissions to execute the child process. This can be done by right-clicking on the script file and selecting “Run as administrator” or by using the command prompt with administrator rights to run the script.

Other popular problems with PSF Requests-HTML


When attempting to scrape a website using requests_html, the script is met with a PermissionError: [WinError 5] Access is denied. This issue is specific to Windows operating systems.


This error is caused by the lack of permissions for the script to access the necessary files for running pyppeteer, a dependency of requests_html. To resolve this issue, run the script as an administrator or add the necessary permissions for the script to access the files.


When attempting to use the render() method of a requests_html object, the script is met with a TimeoutError. This can happen when the website being scraped takes too long to load or the script is unable to connect to the website.


To resolve this issue, increase the timeout value in the session.get() method or check the internet connection. Additionally, check if the website is not blocking the IP address or the headers of the request.


When attempting to scrape a website, the script is met with a ConnectionError. This can happen when the script is unable to connect to the website or the website is blocking the IP address.


To resolve this issue, check the internet connection and ensure that the website is not blocking the IP address or the headers of the request. Additionally, consider using a proxy server to bypass any IP blocking mechanisms.

A brief introduction to PSF Requests-HTML

PSF Requests-HTML is a Python library that allows for easy HTML parsing and rendering. It is built on top of the popular Python Requests library, which is used for making HTTP requests. The HTMLSession class in the library provides a convenient way to interact with web pages, making it simple to extract information or automate web scraping tasks. One of the key features of PSF Requests-HTML is its ability to automatically handle JavaScript rendering, allowing developers to work with the fully-rendered version of a web page.

In addition to its core functionality, PSF Requests-HTML also offers a number of additional features that make it a powerful tool for web scraping and automation. For example, it includes support for cookies, form submissions, and proxy servers, as well as a built-in JSON and XML parsing. With a simple, intuitive interface and a wide range of features, PSF Requests-HTML is a popular choice for developers looking to automate web scraping and other web-based tasks.

Most popular use cases for PSF Requests-HTML

  1. PSF Requests-HTML can be used for web scraping, by providing a convenient and simple way to interact with HTML and XML documents. For example, it can be used to extract data from a website using the following code block:
from requests_html import HTMLSession

session = HTMLSession()
r = session.get('https://example.com')
  1. It can also be used for web automation, such as filling out forms and clicking buttons on a website. A code block for this use case would look like:
from requests_html import HTMLSession

session = HTMLSession()
r = session.get('https://example.com/login')
form = r.html.find('form')[0]
form.fields['username'] = 'myusername'
form.fields['password'] = 'mypassword'
r = session.post(form.url, data=form.fields)
  1. PSF Requests-HTML also allows for rendering of JavaScript-rendered content, using the Pyppeteer library. The following code block demonstrates how to render JavaScript content:
from requests_html import HTMLSession

session = HTMLSession()
r = session.get('https://example.com/javascript-rendered-page')

It’s Really not that Complicated.

You can actually understand what’s going on inside your live applications. It’s a registration form away.

Get Lightrun

Lets Talk!

Looking for more information about Lightrun and debugging?
We’d love to hear from you!
Drop us a line and we’ll get back to you shortly.

By submitting this form, I agree to Lightrun’s Privacy Policy and Terms of Use.