diff --git a/core/interact/interact.py b/core/interact/interact.py index 33803a1..e74bdf4 100644 --- a/core/interact/interact.py +++ b/core/interact/interact.py @@ -357,8 +357,6 @@ class InteractBase(object): return result def input_process(self, stdin_fd, sq, str): - from core import osex - osex.linux_ignore_UserWarning() sys.stdin = os.fdopen(stdin_fd) try: inp = input (str) @@ -387,9 +385,6 @@ class InteractBase(object): return inp def input_process_skip_pending(self, stdin_fd): - from core import osex - osex.linux_ignore_UserWarning() - sys.stdin = os.fdopen(stdin_fd) while True: try: diff --git a/core/joblib/SubprocessorBase.py b/core/joblib/SubprocessorBase.py index 35a2abb..181c8cf 100644 --- a/core/joblib/SubprocessorBase.py +++ b/core/joblib/SubprocessorBase.py @@ -54,10 +54,7 @@ class Subprocessor(object): def log_err(self, msg): self.c2s.put ( {'op': 'log_err' , 'msg':msg } ) def progress_bar_inc(self, c): self.c2s.put ( {'op': 'progress_bar_inc' , 'c':c } ) - def _subprocess_run(self, client_dict, s2c, c2s): - from core import osex - osex.linux_ignore_UserWarning() - + def _subprocess_run(self, client_dict, s2c, c2s): self.c2s = c2s data = None is_error = False @@ -80,7 +77,7 @@ class Subprocessor(object): time.sleep(0.001) self.on_finalize() - c2s.put ( {'op': 'finalized'} ) + c2s.put ( {'op': 'finalized'} ) except Subprocessor.SilenceException as e: c2s.put ( {'op': 'error', 'data' : data} ) except Exception as e: @@ -89,7 +86,7 @@ class Subprocessor(object): print ('Exception while process data [%s]: %s' % (self.get_data_name(data), traceback.format_exc()) ) else: print ('Exception: %s' % (traceback.format_exc()) ) - + c2s.close() s2c.close() self.c2s = None diff --git a/core/osex.py b/core/osex.py index 9b759e2..9297ba9 100644 --- a/core/osex.py +++ b/core/osex.py @@ -33,12 +33,4 @@ def get_screen_size(): elif 'linux' in sys.platform: pass - return (1366, 768) - -def linux_ignore_UserWarning(): - if sys.platform[0:3] != 'win': - # fix for Linux , Ignoring : - # /usr/lib/python3.6/multiprocessing/semaphore_tracker.py:143: - # UserWarning: semaphore_tracker: There appear to be 1 leaked semaphores to clean up at shutdown - import warnings - warnings.filterwarnings(action='ignore', message='semaphore_tracker') \ No newline at end of file + return (1366, 768) \ No newline at end of file diff --git a/main.py b/main.py index 7c29257..0a6145f 100644 --- a/main.py +++ b/main.py @@ -3,9 +3,6 @@ if __name__ == "__main__": import multiprocessing multiprocessing.set_start_method("spawn") - from core import osex - osex.linux_ignore_UserWarning() - from core.leras import nn nn.initialize_main_env() @@ -14,7 +11,8 @@ if __name__ == "__main__": import time import argparse - from core import pathex + from core import pathex + from core import osex from pathlib import Path from core.interact import interact as io @@ -352,7 +350,9 @@ if __name__ == "__main__": arguments.func(arguments) print ("Done.") - +else: + import warnings + warnings.filterwarnings(action='ignore', message='semaphore_tracker') ''' import code code.interact(local=dict(globals(), **locals()))