path_file = open('D:/Develop/redirect_watotg/geckodriver.log')
matches = []
for line in path_file:
if line.count('rust_mozprofile'):
matches.append(line)
profile_path = 'C:/Users/kshnk/AppData/Local/Temp/' + matches[-1].split('\"')[-2].split('\\')[-1]
shutil.rmtree('D:/Develop/redirect_watotg/Profile')
shutil.copytree(profile_path, 'D:/Develop/redirect_watotg/Profile/')
Ошибка при выполнении:
Traceback (most recent call last):
File "D:/Develop/redirect_watotg/main.py", line 23, in
functions.render_page(driver)
File "D:\Develop\redirect_watotg\functions.py", line 205, in render_page
auth(driver)
File "D:\Develop\redirect_watotg\functions.py", line 57, in auth
copy_profile()
File "D:\Develop\redirect_watotg\functions.py", line 48, in copy_profile
shutil.copytree(profile_path, 'D:/Develop/redirect_watotg/Profile/')
File "C:\Python37\lib\shutil.py", line 365, in copytree
raise Error(errors)
shutil.Error: [('C:/Users/kshnk/AppData/Local/Temp/rust_mozprofile.vr3JgctDA9sa\\parent.lock', 'D:/Develop/redirect_watotg/Profile/parent.lock', "[Errno 13] Permission denied: 'C:/Users/kshnk/AppData/Local/Temp/rust_mozprofile.vr3JgctDA9sa\\\\parent.lock'")]
Process finished with exit code 1
На момент выполнения функции в profile_path значение:
C:/Users/kshnk/AppData/Local/Temp/rust_mozprofile.vr3JgctDA9sa
Копирование, соответственно, происходит не до конца.