samedi 28 mars 2015

Error generating objects in a for loop

When I run the next code, I get this error:



>(Pdb)
>Traceback (most recent call last):
> File "simulacion.py", line 203, in <module>
> env.run( until = 120*10000 )
> File "/usr/local/lib/python2.7/dist-packages/http://ift.tt/1IGZVpW", line 137, in run
self.step()
> File "/usr/local/lib/python2.7/dist-packages/http://ift.tt/1IGZVpW", line 229, in step
> raise exc
>TypeError: not all arguments converted during string formatting
>Exception AttributeError: "'NoneType' object has no attribute 'path'" in ><function _remove at 0xb7254bc4> ignored


The code:



import pdb
import simpy
import random
import itertools
import sys

while(True):
...
r = random.uniform(0,1)
t = random.expovariate(300)
yield env.timeout(t)
....


I found the error, just when I run the yield env.timeout(t) line





Aucun commentaire:

Enregistrer un commentaire