这个 python 源代码有什么问题?
import threading
import subprocess as sub
def ben(fil):
pr = sub.Popen(fil,stdout=sub.PIPE,stderr=sub.PIPE)
output, errors = pr.communicate()
print output
theapp = '''blender
blender-softwaregl'''.split()
print theapp
for u in theapp:
print u
tr = threading.Thread(target=ben, args=(u))
tr.daemon = True
tr.start()
错误是:
['blender', 'blender-softwaregl']
blender
Exception in thread Thread-1:
Traceback (most recent call last):
File "/usr/local/lib/python2.7/threading.py", line 551, in __bootstrap_inner
self.run()
File "/usr/local/lib/python2.7/threading.py", line 504, in run
self.__target(*self.__args, **self.__kwargs)
TypeError: ben() takes exactly 1 argument (7 given)
blender-softwaregl
Exception in thread Thread-2:
Traceback (most recent call last):
File "/usr/local/lib/python2.7/threading.py", line 551, in __bootstrap_inner
self.run()
File "/usr/local/lib/python2.7/threading.py", line 504, in run
self.__target(*self.__args, **self.__kwargs)
TypeError: ben() takes exactly 1 argument (18 given)
这是我的问题。这是什么错误?
TypeError: ben() takes exactly 1 argument (18 given)