async fuction

MRAB python at mrabarnett.plus.com
Sat Jan 12 19:01:35 CET 2013


On 2013-01-12 04:43, aleksey at silk.bz wrote:
> Hello.
>
> Can someone help me to resolv error.
>
> code:
>
[snip]
>
> @Async
> def fnc(pi, pp):
>
>      print "fnc-"
>      i=pi
>      while ( i < 10000000 ) :
>          i=i+1
>      print "fnc+"
>      pass
>
> @Async
> def fnc1(pp):
>      print "fnc1-",pp
>
>
> @Async
> def fnc2():
>      print "fnc2-"
>      i=0
>      while ( i < 100000 ) :
>          i=i+1
>      print "fnc2+"
>      pass
>
> fnc(i=0,pp="123123")
> fnc1()
>
>
> error:
>
> Exception in thread fnc1:
> Traceback (most recent call last):
>    File "C:\Python27\lib\threading.py", line 551, in __bootstrap_inner
>      self.run()
>    File "C:\Python27\lib\threading.py", line 504, in run
>      self.__target(*self.__args, **self.__kwargs)
>    File "C:/Users/rootiks/YandexDisk/py/myftpbackup/asynclib.py", line 26, in run
>      self.Result = self.Callable(*args, **kwargs)
> TypeError: fnc1() takes exactly 1 argument (0 given)
>
1. You're calling function 'fnc' with keyword arguments 'i' and 'pp';
it's expecting 'pi' and 'pp'.

2. You're calling function 'fnc1' with no arguments; it's expecting one
argument.




More information about the Python-list mailing list