File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -518,7 +518,7 @@ def save_screenshot(
518518 self ,
519519 filename : str | None = None ,
520520 path : str = "./" ,
521- time_format : str = "%Y-%m- %d %X %f" ,
521+ time_format : str = "%Y%m %d %H%M%S %f" ,
522522 ) -> str :
523523 """Save an SVG screenshot of the current screen.
524524
@@ -535,12 +535,13 @@ def save_screenshot(
535535 svg_filename = (
536536 f"{ self .title .lower ()} { datetime .now ().strftime (time_format )} .svg"
537537 )
538- svg_filename = svg_filename .replace ("/" , "_" ).replace ("\\ " , "_" )
538+ for reserved in '<>:"/\\ |?*' :
539+ svg_filename = svg_filename .replace (reserved , "_" )
539540 else :
540541 svg_filename = filename
541542 svg_path = os .path .expanduser (os .path .join (path , svg_filename ))
542543 screenshot_svg = self .export_screenshot ()
543- with open (svg_path , "w" ) as svg_file :
544+ with open (svg_path , "w" , encoding = "utf-8" ) as svg_file :
544545 svg_file .write (screenshot_svg )
545546 return svg_path
546547
You can’t perform that action at this time.
0 commit comments