Skip to content

Commit e98b30b

Browse files
committed
[FIX BUG] py2 py3 Queue --> queue
1 parent dea2a0e commit e98b30b

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

tensorlayer/prepro.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,15 @@
1111
import random
1212
import os
1313
import re
14+
import sys
1415

1516
import threading
16-
import Queue
17+
# import Queue # <-- donot work for py3
18+
is_py2 = sys.version[0] == '2'
19+
if is_py2:
20+
import Queue as queue
21+
else:
22+
import queue as queue
1723

1824
from six.moves import range
1925
import scipy
@@ -81,7 +87,7 @@ def function(q, data, kwargs):
8187
result = fn(data, **kwargs)
8288
q.put(result)
8389
## start threading
84-
q = Queue.Queue()
90+
q = queue.Queue()
8591
for i in range(len(data)):
8692
d = threading.Thread(
8793
name='threading_and_return',

0 commit comments

Comments
 (0)