gyrojeff commited on
Commit
fb7efe2
·
1 Parent(s): 6c2edf7

fix: `time_ns` unavailable for lower version of python

Browse files
Files changed (1) hide show
  1. font_ds_generate_script.py +3 -1
font_ds_generate_script.py CHANGED
@@ -31,6 +31,8 @@ test_cnt_cjk = int(test_cnt * cjk_ratio)
31
  dataset_path = "./dataset/font_img"
32
  os.makedirs(dataset_path, exist_ok=True)
33
 
 
 
34
 
35
  fonts, exclusion_rule = load_fonts()
36
  corpus_manager = CorpusGeneratorManager()
@@ -75,7 +77,7 @@ def generate_dataset(dataset_type: str, cnt: int):
75
  return
76
  except UnqualifiedFontException as e:
77
  print(f"SKIPPING Unqualified font: {e.font.path}")
78
- with open(f"unqualified_font_{time.time_ns()}.txt", "a") as f:
79
  f.write(f"{e.font.path}\n")
80
  return
81
  except Exception as _:
 
31
  dataset_path = "./dataset/font_img"
32
  os.makedirs(dataset_path, exist_ok=True)
33
 
34
+ unqualified_log_file_name = f"unqualified_font_{time.time_ns()}.txt"
35
+
36
 
37
  fonts, exclusion_rule = load_fonts()
38
  corpus_manager = CorpusGeneratorManager()
 
77
  return
78
  except UnqualifiedFontException as e:
79
  print(f"SKIPPING Unqualified font: {e.font.path}")
80
+ with open(unqualified_log_file_name, "a+") as f:
81
  f.write(f"{e.font.path}\n")
82
  return
83
  except Exception as _: