signal.alarm(5);
try:
fcntl.flock(f2, fcntl.LOCK_EX)
- except IOError, e:
+ except IOError as e:
if e.errno != errno.EINTR:
raise
else:
lockdata = struct.pack('hhllhh', fcntl.F_WRLCK, 0, 0, 10, 0, 0)
try:
fcntl.fcntl(f1, fcntl.F_OFD_SETLK, lockdata)
- except IOError, e:
+ except IOError as e:
if e.errno != errno.EINVAL:
raise
else:
- print 'kernel does not support fcntl.F_OFD_SETLK'
+ print('kernel does not support fcntl.F_OFD_SETLK')
return
lockdata = struct.pack('hhllhh', fcntl.F_WRLCK, 0, 10, 10, 0, 0)
try:
lockdata = struct.pack('hhllhh', fcntl.F_WRLCK, 0, 0, 0, 0, 0)
fcntl.fcntl(f2, fcntl.F_OFD_SETLKW, lockdata)
- except IOError, e:
+ except IOError as e:
if e.errno != errno.EINTR:
raise
else:
try:
lockdata = struct.pack('hhllhh', fcntl.F_WRLCK, 0, 10, 10, 0, 0)
fcntl.fcntl(f1, fcntl.F_OFD_SETLK, lockdata)
- except IOError, e:
+ except IOError as e:
if e.errno == errno.EAGAIN:
pass
else:
fcntl.fcntl(f1, fcntl.F_OFD_SETLK, lockdata)
fcntl.fcntl(f2, fcntl.F_OFD_SETLK, lockdata)
- print 'ok'
+ print('ok')
+
main()