You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-3-86e11d266020> in <module>
----> 1 data= generate_slabs(
2 structure='./POSCAR.mp-149_Si',
3 hkl=2,
4 parallelise=True,
5 #save_metadata=False,
~/tmp/surfaxe/surfaxe/generation.py in generate_slabs(structure, hkl, thicknesses, vacuums, save_slabs, save_metadata, json_fname, make_fols, make_input_files, max_size, center_slab, ox_states, is_symmetric, layers_to_relax, fmt, name, config_dict, user_incar_settings, user_kpoints_settings, user_potcar_settings, parallelise, **kwargs)
298 i['slab'] = i['slab'].as_dict()
299 with open(json_fname, 'w') as f:
--> 300 json.dump(unique_list_of_dicts_copy, f)
301
302 if save_slabs:
~/miniconda3/envs/py3w/lib/python3.8/json/__init__.py in dump(obj, fp, skipkeys, ensure_ascii, check_circular, allow_nan, cls, indent, separators, default, sort_keys, **kw)
177 # could accelerate with writelines in some versions of Python, at
178 # a debuggability cost
--> 179 for chunk in iterable:
180 fp.write(chunk)
181
~/miniconda3/envs/py3w/lib/python3.8/json/encoder.py in _iterencode(o, _current_indent_level)
427 yield _floatstr(o)
428 elif isinstance(o, (list, tuple)):
--> 429 yield from _iterencode_list(o, _current_indent_level)
430 elif isinstance(o, dict):
431 yield from _iterencode_dict(o, _current_indent_level)
~/miniconda3/envs/py3w/lib/python3.8/json/encoder.py in _iterencode_list(lst, _current_indent_level)
323 else:
324 chunks = _iterencode(value, _current_indent_level)
--> 325 yield from chunks
326 if newline_indent is not None:
327 _current_indent_level -= 1
~/miniconda3/envs/py3w/lib/python3.8/json/encoder.py in _iterencode_dict(dct, _current_indent_level)
403 else:
404 chunks = _iterencode(value, _current_indent_level)
--> 405 yield from chunks
406 if newline_indent is not None:
407 _current_indent_level -= 1
~/miniconda3/envs/py3w/lib/python3.8/json/encoder.py in _iterencode_dict(dct, _current_indent_level)
403 else:
404 chunks = _iterencode(value, _current_indent_level)
--> 405 yield from chunks
406 if newline_indent is not None:
407 _current_indent_level -= 1
~/miniconda3/envs/py3w/lib/python3.8/json/encoder.py in _iterencode_list(lst, _current_indent_level)
323 else:
324 chunks = _iterencode(value, _current_indent_level)
--> 325 yield from chunks
326 if newline_indent is not None:
327 _current_indent_level -= 1
~/miniconda3/envs/py3w/lib/python3.8/json/encoder.py in _iterencode_dict(dct, _current_indent_level)
403 else:
404 chunks = _iterencode(value, _current_indent_level)
--> 405 yield from chunks
406 if newline_indent is not None:
407 _current_indent_level -= 1
~/miniconda3/envs/py3w/lib/python3.8/json/encoder.py in _iterencode_dict(dct, _current_indent_level)
403 else:
404 chunks = _iterencode(value, _current_indent_level)
--> 405 yield from chunks
406 if newline_indent is not None:
407 _current_indent_level -= 1
~/miniconda3/envs/py3w/lib/python3.8/json/encoder.py in _iterencode(o, _current_indent_level)
436 raise ValueError("Circular reference detected")
437 markers[markerid] = o
--> 438 o = _default(o)
439 yield from _iterencode(o, _current_indent_level)
440 if markers is not None:
~/miniconda3/envs/py3w/lib/python3.8/json/encoder.py in default(self, o)
177
178 """
--> 179 raise TypeError(f'Object of type {o.__class__.__name__} '
180 f'is not JSON serializable')
181
TypeError: Object of type int32 is not JSON serializable
It is caused because the dictionary contains a int as keys. For python this is OK, but not the case for JSON where the keys must be strings. I am not able to pin point where the offending dictionary key is.
The text was updated successfully, but these errors were encountered:
When I run the code below (code version 6cc8c38):
The following error is thrown:
It is caused because the dictionary contains a
int
as keys. For python this is OK, but not the case for JSON where the keys must be strings. I am not able to pin point where the offending dictionary key is.The text was updated successfully, but these errors were encountered: