GameSentenceMiner 2.13.7__py3-none-any.whl → 2.13.7.post1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
GameSentenceMiner/gsm.py CHANGED
@@ -9,6 +9,18 @@ import warnings
9
9
  os.environ.pop('TCL_LIBRARY', None)
10
10
 
11
11
 
12
+ def handle_error_in_initialization(e):
13
+ """Handle errors that occur during initialization."""
14
+ logger.exception(e, exc_info=True)
15
+ logger.info(
16
+ "An error occurred during initialization, Maybe try updating GSM from the menu or if running manually, try installing `pip install --update GameSentenceMiner`")
17
+ try:
18
+ while True:
19
+ time.sleep(1)
20
+ except KeyboardInterrupt:
21
+ logger.info("Exiting due to initialization error.")
22
+ sys.exit(1)
23
+
12
24
  try:
13
25
  import os.path
14
26
  import signal
@@ -45,11 +57,7 @@ try:
45
57
  from GameSentenceMiner.web.texthooking_page import run_text_hooker_page
46
58
  except Exception as e:
47
59
  from GameSentenceMiner.util.configuration import logger, is_linux, is_windows
48
- logger.info(
49
- "Something bad happened during import/initialization, closing in 5 seconds")
50
- logger.exception(e)
51
- time.sleep(5)
52
- sys.exit(1)
60
+ handle_error_in_initialization(e)
53
61
 
54
62
  if is_windows():
55
63
  import win32api
@@ -688,11 +696,7 @@ async def async_main(reloading=False):
688
696
  except Exception as e:
689
697
  logger.error(f"Error stopping observer: {e}")
690
698
  except Exception as e:
691
- logger.error(f"An error occurred during initialization: {e}", exc_info=True)
692
- notification.send_error_notification(
693
- "An error occurred during initialization. Check the log for details.")
694
- asyncio.sleep(5)
695
- raise e
699
+ handle_error_in_initialization(e)
696
700
 
697
701
 
698
702
  def main():
@@ -701,10 +705,8 @@ def main():
701
705
  try:
702
706
  asyncio.run(async_main())
703
707
  except Exception as e:
704
- logger.exception(e, exc_info=True)
705
- logger.info(
706
- "An error occurred during initialization, closing in 5 seconds")
707
- time.sleep(5)
708
+ handle_error_in_initialization(e)
709
+
708
710
 
709
711
 
710
712
  if __name__ == "__main__":
@@ -712,7 +714,4 @@ if __name__ == "__main__":
712
714
  try:
713
715
  asyncio.run(async_main())
714
716
  except Exception as e:
715
- logger.exception(e, exc_info=True)
716
- logger.info(
717
- "An error occurred during initialization, closing in 5 seconds")
718
- time.sleep(5)
717
+ handle_error_in_initialization(e)
@@ -865,7 +865,7 @@ def load_config():
865
865
 
866
866
  if os.path.exists('config.json') and not os.path.exists(config_path):
867
867
  shutil.copy('config.json', config_path)
868
-
868
+
869
869
  if os.path.exists(config_path):
870
870
  try:
871
871
  with open(config_path, 'r') as file:
@@ -880,20 +880,21 @@ def load_config():
880
880
  config = ProfileConfig.from_dict(config_file)
881
881
  new_config = Config(configs = {DEFAULT_CONFIG : config}, current_profile=DEFAULT_CONFIG)
882
882
 
883
- with open(config_path, 'w') as file:
884
- json.dump(new_config.to_dict(), file, indent=4)
883
+ config.save()
885
884
  return new_config
886
885
  except json.JSONDecodeError as e:
887
- logger.error(f"Error parsing config.json: {e}")
888
- return None
886
+ logger.error(f"Error parsing config.json, saving backup and returning new config: {e}")
887
+ shutil.copy(config_path, config_path + '.bak')
888
+ config = Config.new()
889
+ config.save()
890
+ return config
889
891
  elif os.path.exists('config.toml'):
890
892
  config = ProfileConfig().load_from_toml('config.toml')
891
893
  new_config = Config({DEFAULT_CONFIG: config}, current_profile=DEFAULT_CONFIG)
892
894
  return new_config
893
895
  else:
894
896
  config = Config.new()
895
- with open(config_path, 'w') as file:
896
- json.dump(config.to_dict(), file, indent=4)
897
+ config.save()
897
898
  return config
898
899
 
899
900
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: GameSentenceMiner
3
- Version: 2.13.7
3
+ Version: 2.13.7.post1
4
4
  Summary: A tool for mining sentences from games. Update: Overlay?
5
5
  Author-email: Beangate <bpwhelan95@gmail.com>
6
6
  License: MIT License
@@ -2,7 +2,7 @@ GameSentenceMiner/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU
2
2
  GameSentenceMiner/anki.py,sha256=FUwcWO0-arzfQjejQmDKP7pNNakhboo8InQ4s_jv6AY,19099
3
3
  GameSentenceMiner/config_gui.py,sha256=x8H3HXoRlnfgiFczAoCe1wiCoQDP8MWV0v7am36q3Co,126479
4
4
  GameSentenceMiner/gametext.py,sha256=qR32LhXAo1_a4r01zd7Pm2Yj4ByYCw58u78JdFkSxh4,10939
5
- GameSentenceMiner/gsm.py,sha256=5LBoV_vCjR6cKvpbQBOVXfI15FYae2qLFC3rXe8pApY,27852
5
+ GameSentenceMiner/gsm.py,sha256=F_fiYcpGaHF_xHEmJ0R8oPzoFQHMgKjWX6tbi7DxIuM,27763
6
6
  GameSentenceMiner/obs.py,sha256=alh8G-0vEWxV46WqgVsgNU5_PC5JNzyXJdmVetjiGRo,18819
7
7
  GameSentenceMiner/vad.py,sha256=zFReBMvNEEaQ_YEozCTCaMdV-o40FwtlxYRb17cYZio,19125
8
8
  GameSentenceMiner/ai/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -33,7 +33,7 @@ GameSentenceMiner/owocr/owocr/run.py,sha256=asd5RsYRlsN7FhnMgbjDcN_m3QtVCWzysb6P
33
33
  GameSentenceMiner/owocr/owocr/screen_coordinate_picker.py,sha256=Na6XStbQBtpQUSdbN3QhEswtKuU1JjReFk_K8t5ezQE,3395
34
34
  GameSentenceMiner/util/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
35
35
  GameSentenceMiner/util/audio_offset_selector.py,sha256=8Stk3BP-XVIuzRv9nl9Eqd2D-1yD3JrgU-CamBywJmY,8542
36
- GameSentenceMiner/util/configuration.py,sha256=DWqwhEaCUoTYZiahAK151Upagw8maxRLsKIwemJ2ssg,37337
36
+ GameSentenceMiner/util/configuration.py,sha256=M0TqVXHF2hZz2VqLhDFdGALL9IsNH3fZ9nskAMSVVuI,37332
37
37
  GameSentenceMiner/util/electron_config.py,sha256=9CA27nzEFlxezzDqOPHxeD4BdJ093AnSJ9DJTcwWPsM,8762
38
38
  GameSentenceMiner/util/ffmpeg.py,sha256=t0tflxq170n8PZKkdw8fTZIUQfXD0p_qARa9JTdhBTc,21530
39
39
  GameSentenceMiner/util/gsm_utils.py,sha256=iRyLVcodMptRhkCzLf3hyqc6_RCktXnwApi6mLju6oQ,11565
@@ -67,9 +67,9 @@ GameSentenceMiner/web/templates/index.html,sha256=Gv3CJvNnhAzIVV_QxhNq4OD-pXDt1v
67
67
  GameSentenceMiner/web/templates/text_replacements.html,sha256=tV5c8mCaWSt_vKuUpbdbLAzXZ3ATZeDvQ9PnnAfqY0M,8598
68
68
  GameSentenceMiner/web/templates/utility.html,sha256=3flZinKNqUJ7pvrZk6xu__v67z44rXnaK7UTZ303R-8,16946
69
69
  GameSentenceMiner/wip/get_overlay_coords.py,sha256=nJRytHJwUBToXeAIkf45HP7Yv42YO-ILbP5h8GVeE2Q,19791
70
- gamesentenceminer-2.13.7.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
71
- gamesentenceminer-2.13.7.dist-info/METADATA,sha256=kx4ThmCKdURsRILfpqv07hpD0rqSj85IX-VRPeuRbYA,1463
72
- gamesentenceminer-2.13.7.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
73
- gamesentenceminer-2.13.7.dist-info/entry_points.txt,sha256=2APEP25DbfjSxGeHtwBstMH8mulVhLkqF_b9bqzU6vQ,65
74
- gamesentenceminer-2.13.7.dist-info/top_level.txt,sha256=V1hUY6xVSyUEohb0uDoN4UIE6rUZ_JYx8yMyPGX4PgQ,18
75
- gamesentenceminer-2.13.7.dist-info/RECORD,,
70
+ gamesentenceminer-2.13.7.post1.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
71
+ gamesentenceminer-2.13.7.post1.dist-info/METADATA,sha256=RzUIvb_zGe6KOHa8qtlYFMBd50r3NCn4q4F9VHnxYBg,1469
72
+ gamesentenceminer-2.13.7.post1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
73
+ gamesentenceminer-2.13.7.post1.dist-info/entry_points.txt,sha256=2APEP25DbfjSxGeHtwBstMH8mulVhLkqF_b9bqzU6vQ,65
74
+ gamesentenceminer-2.13.7.post1.dist-info/top_level.txt,sha256=V1hUY6xVSyUEohb0uDoN4UIE6rUZ_JYx8yMyPGX4PgQ,18
75
+ gamesentenceminer-2.13.7.post1.dist-info/RECORD,,