Aug-02-2019, 11:23 PM
i am getting the error shown below in a minimal little script that runs just 2 threads:
what is bufsize and what set it to a non-integer? is there a way i can set it? or is subprocess.call() not thread-safe?
Output:lt2a/forums /home/forums 1> cat -n trytwocommands.py
1 #!/usr/bin/env python3
2 import subprocess,threading
3 one = threading.Thread(target=subprocess.call,args=['sleep','10001'])
4 two = threading.Thread(target=subprocess.call,args=['sleep','10002'])
5 one.start()
6 two.start()
7 print('started 2 threads, now joining them',flush=1)
8 one.join()
9 two.join()
10 print('joined 2 threads, now done',flush=1)
lt2a/forums /home/forums 2> py3 trytwocommands.py
started 2 threads, now joining them
Exception in thread Thread-2:
Traceback (most recent call last):
File "/usr/lib/python3.6/threading.py", line 916, in _bootstrap_inner
self.run()
File "/usr/lib/python3.6/threading.py", line 864, in run
self._target(*self._args, **self._kwargs)
File "/usr/lib/python3.6/subprocess.py", line 287, in call
with Popen(*popenargs, **kwargs) as p:
File "/usr/lib/python3.6/subprocess.py", line 629, in __init__
raise TypeError("bufsize must be an integer")
TypeError: bufsize must be an integer
Exception in thread Thread-1:
Traceback (most recent call last):
File "/usr/lib/python3.6/threading.py", line 916, in _bootstrap_inner
self.run()
File "/usr/lib/python3.6/threading.py", line 864, in run
self._target(*self._args, **self._kwargs)
File "/usr/lib/python3.6/subprocess.py", line 287, in call
with Popen(*popenargs, **kwargs) as p:
File "/usr/lib/python3.6/subprocess.py", line 629, in __init__
raise TypeError("bufsize must be an integer")
TypeError: bufsize must be an integer
joined 2 threads, now done
lt2a/forums /home/forums 3>
i presume the 2 errors happen in the 2 threads, especially considering the output from the print calls before and after.what is bufsize and what set it to a non-integer? is there a way i can set it? or is subprocess.call() not thread-safe?
Tradition is peer pressure from dead people
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.