I think you may have forgotten to include the error message.
Anyway, a few things that I can see.
Firstly, line 28 probably has a spelling mistake in the first term as I guess you meant
Secondly, is there any particular reason why you only read the wavelength for the first file? I understand that it’s the same for all files, but it simplifies the code if you just get it to read the wavelength each time. Then there’s no need for the
Lastly, if you only want to read the wavelength once, I think there’s something wrong in your logic. Without seeing your file I am not sure, but I think that line 23 is meant to get the wavelength. Then line 24 combines this wavelength with the transmission data and then overwrites the original wavelength information with this new 2D array. The trouble is that this means that line 28 is then trying to combine this 2D array with the new transmission instead of just the wavelength and the new transmission.
As a guess I would replace line 23 with
lambda = T.lambda;
and then replace both line 24 and line 28 with
Hopefully that works, but I would still just get read of the
else to keep things simple.