You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I solved the problem above. The folder name cannot contain these symbols like '?:'. This renaming problem may only occur in Chinese edition Windows10 or 11.
The code I changed as follows. I added a regex to delete the annoying symbols. Maybe you have a better solution!
#changed by woden
import re
def replace_filename(str):
numDict = {':':' ','?':' ','|':' ','>':' ','<':' ','/':' '}
print(str.group())
return numDict[str.group()]
#end
def scrape_page(driver, file_index):
scroll_page(driver)
wait_webdriver(driver)
title = get_file_name(driver)
check_page(title)
file_name = str(file_index) + "-" + title
# change by woden
a = re.sub(r'[:?|></]', replace_filename, file_name)
# a = ''.join(filter(lambda i: i in [' '] or i.isalnum(),file_name))
# end
driver.set_window_size(1920, get_current_height(driver))
remove_nav_tags(driver)
show_hints_answer(driver)
mark_down_quiz(driver)
show_code_box_answer(driver)
open_slides(driver)
create_folder(a)
quiz_html = take_quiz_screenshot(driver)
# take_screenshot(driver, file_name, quiz_html)
add_name_tag_in_next_back_button(driver)
fix_all_svg_tags_inside_object_tags(driver)
#woden change
get_pagecontent_using_singleFile(driver, "main", quiz_html)
#end
code_widget_type(driver)
code_container_download_type(driver)
code_container_clipboard_type(driver)
demark_as_completed(driver)
if not next_page(driver):
sleep(5)
return False
return True
def create_course_folder(driver, url):
print("Create Course Folder Function")
course_name = get_file_name(driver, True)
x = re.sub(r'[:?|></]', replace_filename, course_name)
create_folder(x)
print("Inside Course Folder")
I have tested these codes. no problem.
But I am a python beginner, the above code may have some bug.
The text was updated successfully, but these errors were encountered:
It would be better to add the regex in get_file_name function to reduce redundancy @haha2345
Normally slugify should remove the characters that are invalid for windows
I solved the problem above. The folder name cannot contain these symbols like '?:'. This renaming problem may only occur in Chinese edition Windows10 or 11.
The code I changed as follows. I added a regex to delete the annoying symbols. Maybe you have a better solution!
I have tested these codes. no problem.
But I am a python beginner, the above code may have some bug.
The text was updated successfully, but these errors were encountered: