f90nml: Write bug in v0.20
I’m getting an odd bug when trying the write the following namelist:
&a
b%c_d_E(1)%ID = 1,
b%c_d_E(2)%ID = 2,
/
Code is:
import f90nml
data = f90nml.read('test.nml')
with open('test_RESAVED.nml','w') as f:
data.write(f, force=True)
Error message is:
Traceback (most recent call last):
File "test.py", line 309, in <module>
data.write(f, force=True)
File "C:\Anaconda3\lib\site-packages\f90nml\namelist.py", line 232, in write
self.write_nmlgrp(grp_name, grp_vars, nml_file)
File "C:\Anaconda3\lib\site-packages\f90nml\namelist.py", line 253, in write_nmlgrp
for v_str in self.var_strings(v_name, v_val, v_start=v_start):
File "C:\Anaconda3\lib\site-packages\f90nml\namelist.py", line 302, in var_strings
v_strs = self.var_strings(v_title, f_vals, v_start=v_start_new)
File "C:\Anaconda3\lib\site-packages\f90nml\namelist.py", line 313, in var_strings
i_s = v_start[::-1][len(v_idx)]
TypeError: 'NoneType' object is not subscriptable
Oddly, when I change c_d_E to c_d_e, it works fine.
I just updated to the latest release using pip. I’ve been able to read variables like this before, so something has changed.
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 20 (12 by maintainers)
Commits related to this issue
- New derived type tests added Derived type test cases, primarily around upper case keys, provided by Jacob William (Github #40) are added here. — committed to marshallward/f90nml by marshallward 7 years ago
Sorry about that, I had hoped to look into that 72+ character variable name bug, but never got a chance. I’ve done a version update containing the derived type changes though and sent it to pypi
On Thu, Feb 2, 2017 at 7:21 AM, Jacob Williams notifications@github.com wrote: