threading problem

Egor Bolonev ebolonev at mail.ru
Thu Dec 9 18:40:22 EST 2004


hi all

my program terminates with error i dont know why it tells 'TypeError:  
run() takes exactly 1 argument (10 given)'

=program====================
import os, os.path, threading, sys

def get_all_files(path):
     """return all files of folder path, scan with subfolders
     """
     if len(path) > 0:
         if path[-1] == ':':
             path=path+'\\'
     try:
         for i in os.listdir(path):
             j = os.path.join(path, i)
             if os.path.isdir(j):
                 for ii in get_all_files(j):
                     yield ii
             if os.path.isfile(j):
                 yield j
     except:pass

#----------------

lock1 = threading.Lock()

def run(path):
     for i in get_all_files(path):
         lock1.acquire()
         print i
         lock1.release()

#----------------

for path in os.listdir('c:\\'):
     if os.path.isdir(os.path.join('c:\\', path)):
         threading.Thread(target = run, args = (os.path.join('c:\\',  
path))).start()
     else:
         lock1.acquire()
         print path
         lock1.release()
============================




=output=====================
>>> ================================ RESTART  
>>> ================================
>>>
AUTOEXEC.BAT
boot.iniException in thread Thread-1:
Traceback (most recent call last):
   File "C:\Python23\lib\threading.py", line 436, in __bootstrap
     self.run()
   File "C:\Python23\lib\threading.py", line 416, in run
     self.__target(*self.__args, **self.__kwargs)
TypeError: run() takes exactly 1 argument (10 given)


Bootfont.bin
BOOTLOG.PRV
BOOTLOG.TXT
BOOTSECT.DOS
COMMAND.COM
CONFIG.SYS
DETLOG.TXT
devicetable.log
Exception in thread Thread-2:
Traceback (most recent call last):
   File "C:\Python23\lib\threading.py", line 436, in __bootstrap
     self.run()
   File "C:\Python23\lib\threading.py", line 416, in run
     self.__target(*self.__args, **self.__kwargs)
TypeError: run() takes exactly 1 argument (25 given)

FRUNLOG.TXT
Exception in thread Thread-3:
Traceback (most recent call last):
   File "C:\Python23\lib\threading.py", line 436, in __bootstrap
     self.run()
   File "C:\Python23\lib\threading.py", line 416, in run
     self.__target(*self.__args, **self.__kwargs)
TypeError: run() takes exactly 1 argument (9 given)

hsf5442.sys
Exception in thread Thread-4:
Traceback (most recent call last):
   File "C:\Python23\lib\threading.py", line 436, in __bootstrap
     self.run()
   File "C:\Python23\lib\threading.py", line 416, in run
     self.__target(*self.__args, **self.__kwargs)
TypeError: run() takes exactly 1 argument (10 given)

IO.SYS
LOGO.SYS
MSDOS.---
MSDOS.SYS
netldx.vxd
NETLOG.TXT
NHL2005.mdf
NHL2005.mds
ntdetect.com
ntldr
Exception in thread Thread-5:
Traceback (most recent call last):
   File "C:\Python23\lib\threading.py", line 436, in __bootstrap
     self.run()
   File "C:\Python23\lib\threading.py", line 416, in run
     self.__target(*self.__args, **self.__kwargs)
TypeError: run() takes exactly 1 argument (9 given)

PAGEFILE.SYS
Exception in thread Thread-6:
Traceback (most recent call last):
   File "C:\Python23\lib\threading.py", line 436, in __bootstrap
     self.run()
   File "C:\Python23\lib\threading.py", line 416, in run
     self.__target(*self.__args, **self.__kwargs)
TypeError: run() takes exactly 1 argument (16 given)

Exception in thread Thread-7:
Traceback (most recent call last):
   File "C:\Python23\lib\threading.py", line 436, in __bootstrap
     self.run()
   File "C:\Python23\lib\threading.py", line 416, in run
     self.__target(*self.__args, **self.__kwargs)
TypeError: run() takes exactly 1 argument (11 given)

Exception in thread Thread-8:
Traceback (most recent call last):
   File "C:\Python23\lib\threading.py", line 436, in __bootstrap
     self.run()
   File "C:\Python23\lib\threading.py", line 416, in run
     self.__target(*self.__args, **self.__kwargs)
TypeError: run() takes exactly 1 argument (11 given)

Exception in thread Thread-9:
Traceback (most recent call last):
   File "C:\Python23\lib\threading.py", line 436, in __bootstrap
     self.run()
   File "C:\Python23\lib\threading.py", line 416, in run
     self.__target(*self.__args, **self.__kwargs)
TypeError: run() takes exactly 1 argument (11 given)

rew.ini
Exception in thread Thread-10:
Traceback (most recent call last):
   File "C:\Python23\lib\threading.py", line 436, in __bootstrap
     self.run()
   File "C:\Python23\lib\threading.py", line 416, in run
     self.__target(*self.__args, **self.__kwargs)
TypeError: run() takes exactly 1 argument (10 given)

SETUPLOG.TXT
SUHDLOG.DAT
Exception in thread Thread-11:
Traceback (most recent call last):
   File "C:\Python23\lib\threading.py", line 436, in __bootstrap
     self.run()
   File "C:\Python23\lib\threading.py", line 416, in run
     self.__target(*self.__args, **self.__kwargs)
TypeError: run() takes exactly 1 argument (28 given)

SYSTEM.1ST
Exception in thread Thread-12:
Traceback (most recent call last):
   File "C:\Python23\lib\threading.py", line 436, in __bootstrap
     self.run()
   File "C:\Python23\lib\threading.py", line 416, in run
     self.__target(*self.__args, **self.__kwargs)
TypeError: run() takes exactly 1 argument (7 given)

Exception in thread Thread-13:
Traceback (most recent call last):
   File "C:\Python23\lib\threading.py", line 436, in __bootstrap
     self.run()
   File "C:\Python23\lib\threading.py", line 416, in run
     self.__target(*self.__args, **self.__kwargs)
TypeError: run() takes exactly 1 argument (7 given)

Exception in thread Thread-14:
Traceback (most recent call last):
   File "C:\Python23\lib\threading.py", line 436, in __bootstrap
     self.run()
   File "C:\Python23\lib\threading.py", line 416, in run
     self.__target(*self.__args, **self.__kwargs)
TypeError: run() takes exactly 1 argument (10 given)

Exception in thread Thread-15:
Traceback (most recent call last):
   File "C:\Python23\lib\threading.py", line 436, in __bootstrap
     self.run()
   File "C:\Python23\lib\threading.py", line 416, in run
     self.__target(*self.__args, **self.__kwargs)
TypeError: run() takes exactly 1 argument (8 given)

~WRD0003.tmp
Exception in thread Thread-16:
Traceback (most recent call last):
   File "C:\Python23\lib\threading.py", line 436, in __bootstrap
     self.run()
   File "C:\Python23\lib\threading.py", line 416, in run
     self.__target(*self.__args, **self.__kwargs)
TypeError: run() takes exactly 1 argument (16 given)

>>>
============================



More information about the Python-list mailing list