In some cases, I encountered problems when trying to create output with the G edit descriptor. For example, the script
import fortranformat t = 0.0 fmtline = fortranformat.FortranRecordWriter('(G10.2)') print fmtline.write([t])
(normally, the output should be just "0.0") stops with the error message
Traceback (most recent call last): File "python_format.py", line 7, in print fmtline.write([t]) File "/home/braun/.python/fortranformat/FortranRecordWriter.py", line 48, in write return _output(self._eds, self._rev_eds, values) File "/home/braun/.python/fortranformat/_output.py", line 128, in output sub_string = _compose_float_string(w, e, d, state, val, 'G') File "/home/braun/.python/fortranformat/_output.py", line 316, in _compose_float_string out = _output_float(w, d, e, state, ftype, buff, sign_bit, zero_flag, ndigits, edigits) File "/home/braun/.python/fortranformat/_output.py", line 425, in _output_float if (nbefore + nafter) == 0: UnboundLocalError: local variable 'nbefore' referenced before assignment
Hi,
In some cases, I encountered problems when trying to create output with the G edit descriptor. For example, the script
import fortranformat t = 0.0 fmtline = fortranformat.FortranRecordWriter('(G10.2)') print fmtline.write([t])
(normally, the output should be just "0.0") stops with the error message
Traceback (most recent call last): File "python_format.py", line 7, in print fmtline.write([t]) File "/home/braun/.python/fortranformat/FortranRecordWriter.py", line 48, in write return _output(self._eds, self._rev_eds, values) File "/home/braun/.python/fortranformat/_output.py", line 128, in output sub_string = _compose_float_string(w, e, d, state, val, 'G') File "/home/braun/.python/fortranformat/_output.py", line 316, in _compose_float_string out = _output_float(w, d, e, state, ftype, buff, sign_bit, zero_flag, ndigits, edigits) File "/home/braun/.python/fortranformat/_output.py", line 425, in _output_float if (nbefore + nafter) == 0: UnboundLocalError: local variable 'nbefore' referenced before assignment