MCPcopy Create free account
hub / github.com/eternnoir/pyTelegramBotAPI / restart_file

Function restart_file

telebot/ext/reloader.py:16–31  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

14 restart_file()
15
16def restart_file():
17 try:
18 p = psutil.Process(os.getpid())
19 for handler in p.open_files() + p.connections():
20 os.close(handler.fd)
21 except OSError:
22 pass
23 except Exception as e:
24 logger.error(e)
25
26 python = sys.executable
27
28 if os.name == 'nt':
29 os.execv(sys.executable, ['python'] + sys.argv)
30 else:
31 os.execl(python, python, *sys.argv)

Callers 1

on_any_eventMethod · 0.85

Calls 1

closeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…