datajoint-python
datajoint-python copied to clipboard
Error with`dj.Diagram()` and new release of `pydot==3.0.*`
trafficstars
Bug Report
One month ago, pydot released version 3.0, which introduced breaking changes (reference). These changes appear to be causing issues with dj.Diagram.
One of the breaking changes in the new version of pydot is Breaking change: Remove .create_attribute_methods() from classes, and the error I received breaks in dj.Diagram using create_*(). The datajoint-python unit tests cover the import and table attributes but not the create attributes reference.
Downgrading to pydot==2.0 resolves these issues and restores plotting functionality for dj.Diagram.
Description
dj.Diagram(probe)
{
"name": "AssertionError",
"message": "\"dot\" with args ['-Tsvg', '/var/folders/h8/_lx50k3d6qx586662kr066h40000gn/T/tmp2kxf9kd7'] returned code: 1",
"stack": "---------------------------------------------------------------------------
AssertionError Traceback (most recent call last)
File ~/miniconda/envs/utah_organoids/lib/python3.10/site-packages/IPython/core/formatters.py:347, in BaseFormatter.__call__(self, obj)
345 method = get_real_method(obj, self.print_method)
346 if method is not None:
--> 347 return method()
348 return None
349 else:
File ~/miniconda/envs/utah_organoids/lib/python3.10/site-packages/datajoint/diagram.py:436, in Diagram._repr_svg_(self)
435 def _repr_svg_(self):
--> 436 return self.make_svg()._repr_svg_()
File ~/miniconda/envs/utah_organoids/lib/python3.10/site-packages/datajoint/diagram.py:424, in Diagram.make_svg(self)
421 def make_svg(self):
422 from IPython.display import SVG
--> 424 return SVG(self.make_dot().create_svg())
File ~/miniconda/envs/utah_organoids/lib/python3.10/site-packages/pydot/core.py:169, in __generate_format_methods.<locals>.__create_method(self, f, prog, encoding)
167 def __create_method(self, f=frmt, prog=None, encoding=None):
168 \"\"\"Refer to docstring of method `create`.\"\"\"
--> 169 return self.create(format=f, prog=prog, encoding=encoding)
File ~/miniconda/envs/utah_organoids/lib/python3.10/site-packages/pydot/core.py:1825, in Dot.create(self, prog, format, encoding)
1819 code = process.returncode
1820 print(
1821 f'\"{prog}\" with args {arguments} returned code: {code}\
\
'
1822 f\"stdout, stderr:\
{stdout_data}\
{stderr_data}\
\"
1823 )
-> 1825 assert process.returncode == 0, (
1826 f'\"{prog}\" with args {arguments} '
1827 f\"returned code: {process.returncode}\"
1828 )
1830 return stdout_data
AssertionError: \"dot\" with args ['-Tsvg', '/var/folders/h8/_lx50k3d6qx586662kr066h40000gn/T/tmp2kxf9kd7'] returned code: 1"
}
Reproducibility
- OS (MACOS)
- Python Version: 3.10
- DataJoint Version: 0.14.1
- pydot Version: 3.0.1
Expected Behavior
The diagram to be plotted in the output.