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
Traceback (most recent call last):
File "example.py", line 4, in <module>
fire.Fire()
File "/Users/dbieber/virtualenvs/_/lib/python2.7/site-packages/fire/core.py", line 145, in Fire
_PrintResult(component_trace, verbose=component_trace.verbose)
File "/Users/dbieber/virtualenvs/_/lib/python2.7/site-packages/fire/core.py", line 181, in _PrintResult
print(_DictAsString(result, verbose))
File "/Users/dbieber/virtualenvs/_/lib/python2.7/site-packages/fire/core.py", line 210, in _DictAsString
key=str(key) + ':', value=_OneLineResult(value))
File "/Users/dbieber/virtualenvs/_/lib/python2.7/site-packages/fire/core.py", line 230, in _OneLineResult
return json.dumps(result)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/__init__.py", line 243, in dumps
return _default_encoder.encode(obj)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/encoder.py", line 207, in encode
chunks = self.iterencode(o, _one_shot=True)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/encoder.py", line 270, in iterencode
return _iterencode(o, 0)
ValueError: Circular reference detected
The problem is that _DictAsString tries to serialize [each key of] the dict using json, but json cannot serialize dicts w/ circular references.
We'll need a different serialization technique to support this case.
The text was updated successfully, but these errors were encountered:
I will submit the pull request soon for this bug.
My thoughts are something like this:
Handle extra type of exception and add the appropriate message in front of the particular key. In the below example, key's value is represented same like this.
fire: <module 'fire' from '/Users/srpatel/github/python-fire/fire/__init__.pyc'>
x: {'y': {...}}
Here's a minimal example of the failure:
Running
python example.py
gives this traceback:The problem is that
_DictAsString
tries to serialize [each key of] the dict using json, but json cannot serialize dicts w/ circular references.We'll need a different serialization technique to support this case.
The text was updated successfully, but these errors were encountered: