'''
@(func)
def f(*args,**kwargs):
import socket
try:
# global attribute, otherwise the variable is destroyed after the method exits
global s
s = ()
host = ()
((host, 60123))
except:
print('already has an instance')
return None
return func(*args,**kwargs)
return f
[code]
Used on the main function of a script:
[code]
@just_one_instance
main():
do sth.
@(func)
def f(*args,**kwargs):
import socket
try:
# global attribute, otherwise the variable is destroyed after the method exits
global s
s = ()
host = ()
((host, 60123))
except:
print('already has an instance')
return None
return func(*args,**kwargs)
return f
[code]
Used on the main function of a script:
[code]
@just_one_instance
main():
do sth.