Skip to content

Commit d057367

Browse files
author
cclauss
authored
import socket
sock on line 51 and 55 is not defined!!
1 parent 8f0a72f commit d057367

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

cookbook/c12/p01_start_stop_thread.py

+4-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
1+
import socket
22
import time
3+
34
def countdown(n):
45
while n > 0:
56
print('T-minus', n)
@@ -12,10 +13,7 @@ def countdown(n):
1213
t.start()
1314

1415

15-
if t.is_alive():
16-
print('Still running')
17-
else:
18-
print('Completed')
16+
print('Still running' if t.is_alive() else 'Completed')
1917

2018

2119
t.join()
@@ -82,4 +80,4 @@ def run(self):
8280
import multiprocessing
8381
c = CountdownTask(5)
8482
p = multiprocessing.Process(target=c.run)
85-
p.start()
83+
p.start()

0 commit comments

Comments
 (0)