/
ilya.petrash
/
SimplePyScripts
Обзор
Документация
Войти
/
ilya.petrash
/
SimplePyScripts
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
prevent_multiple_instances__mutex.py
23 строки
397 B
gil9red
Refactoring. Using black code style
18 июн 2023, 17:14
18 июн 2023, 17:14
5daceab
Код
Авторство
О чём код?
#!/usr/bin/env python3 # -*- coding: utf-8 -*- __author__ = "ipetrash" import sys import time import win32api import win32event import winerror # Prevent multiple instances mutex = win32event.CreateMutex(None, 1, "MY_MUTEX_PYTHON") if win32api.GetLastError() == winerror.ERROR_ALREADY_EXISTS: print("Already running!") mutex = None sys.exit(0) while True: time.sleep(99999)