2

I have a function like this:

def test_readout(self, nr_triggers=10, dump_data=False, lanes=range(9)):

Which is to be called by command line using the fire python module, via a master file called testbench.py. I want to set the parameter lanes to an array with a single value, 8 specifically.

The closest I've gotten is this:

mypython3 ./testbench.py test_readout 10 False [8,8]

This works, but as you can see the array has two duplicate entries for 8 instead of just one. But if I just do:

mypython3 ./testbench.py test_readout 10 False [8]

Then I get this error:

[...]
  File "./testbench.py", line 323, in test_readout
[trig == nr_triggers for trig in event_counters])
TypeError: 'int' object is not iterable

Other strategies like leaving the other parameters at default and setting lanes explicitly like:

mypython3 ./testbench.py test_readout --lanes [8]

Gives this kind of error:

[...]
  File "./testbench.py", line 306, in test_readout
for i in range(nr_triggers):
TypeError: 'str' object cannot be interpreted as an integer

Anyone know the correct way of doing this?

Duke79
  • 827
  • 1
  • 10
  • 21
GrixM
  • 215
  • 2
  • 4
  • 20
  • You're passing a string to range, which only accepts integers. you could try ```for i in range(int(nr_triggers))``` if nr_triggers is a string representation of an integer. Otherwise you'll need to change the variable you pass to range and ensure it's always an integer. – ConorSheehan1 Dec 11 '17 at 14:28

0 Answers0