Closed yushengak47 closed 3 years ago
I think this error is unique to Python3.8+. I am updating the serialization code. In the meantime, do you have access to version 3.6?
Thanks for your reply.
Yes, I'll have a try using python3.6. Will get back to you soon.
The program reports the same error in python3.6 environment
Hmm. I will take a look today and get back to you.
I searched a bit and solved the problem by changing the 365th line of dispersion.pyx:
original: return [str(x.dtype), base64.b64encode(x), x.shape] modified: return [str(x.dtype), base64.b64encode(x).decode('latin1'), x.shape]
By the way, I've encountered another compatible issue in script 'generate_bias_model.sh'. I found the following modifications could solve the problem:
original: 97 while(1): 98 try: 99 read = reads.next() 100 except: 101 break
modified: 97 for read in reads.fetch():
Cheers,
YU Sheng
I just updated the code-base to fix many issues (including the JSON serialization). It is on PyPi: pip install footprint-tools=1.2.1
. You can also use conda to replicate my build environment -- see the README.md file for details.
Fixed in version 1.3.3
Hi,
Thanks for developing this toolkit.
When I run ftd-learn-dispersion-model, it reported the following error:
Traceback (most recent call last): File "/home/yus/.local/bin/ftd-learn-dispersion-model", line 161, in
sys.exit(main())
File "/home/yus/.local/bin/ftd-learn-dispersion-model", line 155, in main
print(dispersion.write_dispersion_model(model), file = sys.stdout)
File "footprint_tools/modeling/dispersion.pyx", line 419, in footprint_tools.modeling.dispersion.write_dispersion_model
File "/home/yus/anaconda3/envs/footprint/lib/python3.9/json/init.py", line 234, in dumps
return cls(
File "/home/yus/anaconda3/envs/footprint/lib/python3.9/json/encoder.py", line 201, in encode
chunks = list(chunks)
File "/home/yus/anaconda3/envs/footprint/lib/python3.9/json/encoder.py", line 431, in _iterencode
yield from _iterencode_dict(o, _current_indent_level)
File "/home/yus/anaconda3/envs/footprint/lib/python3.9/json/encoder.py", line 405, in _iterencode_dict
yield from chunks
File "/home/yus/anaconda3/envs/footprint/lib/python3.9/json/encoder.py", line 325, in _iterencode_list
yield from chunks
File "/home/yus/anaconda3/envs/footprint/lib/python3.9/json/encoder.py", line 438, in _iterencode
o = _default(o)
File "/home/yus/anaconda3/envs/footprint/lib/python3.9/json/encoder.py", line 179, in default
raise TypeError(f'Object of type {o.class.name} '
TypeError: Object of type bytes is not JSON serializable
I searched around and tried several methods with no lucky. Could you give me some help? Thanks.
YU Sheng