PermissionError: [WinError 32] Another program is using this file and the process cannot be accessed. : & #39; C :\\ Users \ video \ AppData \ Local \ Temp \ tmpfipzk8ma & #39; -- solve the problem, win32error0n87

Source: Internet
Author: User

PermissionError: [WinError 32] Another program is using this file and the process cannot be accessed. : 'C: \ Users \ video \ AppData \ Local \ Temp \ tmpfipzk8ma '-- solve the problem, win32error0n87

Learning python + selenium always encounters various problems

The Code is as follows:

From selenium import webdriver
Browser = webdriver. PhantomJS () # initialize the browser. Set the phantomjs path in Win and leave it blank in linux.
Url = 'HTTP: // www.zhidaow.com '# Set the access path
Browser. get (url) # Open the webpage
Title = browser. find_elements_by_xpath ('// h2') # Use xpath to obtain elements

For t in title: # traverse the output
Print (t. text) # output text
Print (t. get_attribute ('class') # output attribute values

Browser. quit ()
An error is reported after running:

File "C: \ Users \ video \ AppData \ Roaming \ Python \ Python34 \ site-packages \ selenium \ webdriver \ common \ service. py ", line 151, in _ del __
File "C: \ Users \ video \ AppData \ Roaming \ Python \ Python34 \ site-packages \ selenium \ webdriver \ common \ service. py", line 127, in stop
File "C: \ Users \ video \ AppData \ Roaming \ Python \ Python34 \ site-packages \ selenium \ webdriver \ phantomjs \ service. py", line 68, in send_remote_shutdown_command
PermissionError: [WinError 32] Another program is using this file and the process cannot be accessed. : 'C: \ Users \ video \ AppData \ Local \ Temp \ tmpfipzk8ma'

 

Solution: (I use pycharm)

Edit the file C: \ Users \ video \ AppData \ Roaming \ Python \ Python34 \ site-packages \ selenium \ webdriver \ phantomjs \ service. py

Find:

def send_remote_shutdown_command(self):
if self._cookie_temp_file:
os.remove(self._cookie_temp_file)
Modify as follows:
def send_remote_shutdown_command(self):

try:
    if self._cookie_temp_file:
      os.remove(self._cookie_temp_file)
except:
    pass

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.