最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

python - IOError happened while use requests-html to render a javascript page - Stack Overflow

programmeradmin2浏览0评论

I was trying to use the new liberary request-html. But when i use the render() function to parse a javascript page, it always pop up with the notes as below:

Error in atexit._run_exitfuncs: Traceback (most recent call last):
File "C:\Program Files (x86)\Python36-32\lib\site-packages\pyppeteer\launcher.py", line 201, in killChrome self._cleanup_tmp_user_data_dir() File "C:\Program Files (x86)\Python36-32\lib\site-packages\pyppeteer\launcher.py", line 130, in _cleanup_tmp_user_data_dir raise IOError('Unable to remove Temporary User Data') OSError: Unable to remove Temporary User Data

I tried to solve the problems, but it seems that there is no solution right now. So i kind of hope someone here can help me.

PS: it seems that i can not post it with the tag:requests-html, i do not have enought repution. So, very sorry for that.

I was trying to use the new liberary request-html. But when i use the render() function to parse a javascript page, it always pop up with the notes as below:

Error in atexit._run_exitfuncs: Traceback (most recent call last):
File "C:\Program Files (x86)\Python36-32\lib\site-packages\pyppeteer\launcher.py", line 201, in killChrome self._cleanup_tmp_user_data_dir() File "C:\Program Files (x86)\Python36-32\lib\site-packages\pyppeteer\launcher.py", line 130, in _cleanup_tmp_user_data_dir raise IOError('Unable to remove Temporary User Data') OSError: Unable to remove Temporary User Data

I tried to solve the problems, but it seems that there is no solution right now. So i kind of hope someone here can help me.

PS: it seems that i can not post it with the tag:requests-html, i do not have enought repution. So, very sorry for that.

Share Improve this question asked Apr 13, 2018 at 4:59 tony.guo140502tony.guo140502 411 silver badge5 bronze badges
Add a ment  | 

4 Answers 4

Reset to default 4

I had the same issue, but it seems to have disappeared after my second run. If it keeps happening, perhaps try closing the request and/or session after you're done:

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

# do something

req.close()
session.close()

I fixed this issue by switch to the administrator mode.

Modify the connection.py file

pyppeteer/connection.py

@@ -41,7 +41,7 @@ def init(self, url: str, loop: asyncio.AbstractEventLoop,

    self.connection: CDPSession
    self._connected = False
    self._ws = websockets.client.connect(
        self._url, max_size=None, loop=self._loop)
        self._url, max_size=None, loop=self._loop, ping_interval=None, ping_timeout=None)
    self._recv_fut = self._loop.create_task(self._recv_loop())
    self._closeCallback: Optional[Callable[[], None]] = None

Fixed mine by adding: PYPPETEER_HOME to environment variables on my PC, and the variable value to a folder on my PC, ie; 'C:\tool'

variable name: PYPPETEER_HOME,

variable value: C:\tool

and I had to restart my system.

发布评论

评论列表(0)

  1. 暂无评论