Thermal electron attachment to O2 in H2 and D2