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

I was trying to use the new liberary request-html.But when i use the render() function to parse a java

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.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745153114a4613955.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信