I think that in your Python block, 'input_items[0]' is a list of lists, so it is like
[ [spectrum_1], [spectrum_2],...,[spectrum_n] ]
and the number of spectra in the list is different for each run of the Python block.
In general, if having a list of lists like
>myList=[ [1,2,3], [4,5,6] ]
then using Numpy's median-command gives
>numpy.median(myList)
3.5
just a scalar, but you want a median value for each of the spectra.
You can do it by using
>numpy.median(myList, axis=1)
array([2., 5.])
Then you have to find out how to divide a list of lists with a Numpy array
(you cannot simply divide myList with the numpy array)
Also, the following for-loop should work:
for i in range(len(input_items[0])):
output_items[0][i] = input_items[0][i] / np.median(input_items[0][i])
Cheers, Kimmo