-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
render() throws error #22
Comments
@mgierdal what OS are you running your Jupyter notebook on? As a side note, currently ‘view()’ is fully supported only Linux and OSX. If you could try using another environment, I suggest Google Colab notebooks (https://colab.research.google.com/). |
@mgierdal You could also try just returning the result of the graph traversal : and then visualize it on cogdb.io > visualization tab. |
It's running on cygwin, which enables Unix-like environment on Windows. It's really very rare to encounter incompatibilities. Effectively cog is NOT running on Windows. Using Colab notebooks or visualization tab is out of question, unfortunately. While I wasn't to "shoot tanks" with cogdb, I intended to put it to small scale, but serious use. Out of curiosity, what are the main issues preventing from using it under actual Windows? |
It looks like the error occurs when using 'render()' which depends on IPython's display module - perhaps there is some incompatibly. You could still see the visualization without using render. You can get the location of the html view file using this: And view the html file containing the graph visualization using a web browser. |
@mgierdal There is nothing preventing it from running on Windows but currently there is no testing done in Windows environment. In theory everything should work just fine on Windows in standard Python. The only exception to that is the 'render' function which is meant to display graph visualizations directly in an IPython notebook. |
Environment:
Python 3.8.9 (default, Apr 21 2021, 23:14:29)
[GCC 10.2.0] on cygwin
cogdb==2.0.5
xxhash==2.0.0
Issue:
When running your introductory example from the main page of https://cogdb.io/ (in a jupyter notebook), the following error was thrown:
OSError Traceback (most recent call last)
in
14 g.put("greg","status","cool_person")
15
---> 16 g.v().tag("from").out("follows").tag("to").view("follows").render()
/usr/local/lib/python3.8/site-packages/cog/torque.py in render(self)
324 iframe_html = r""" <iframe srcdoc='{0}' width="700" height="700"> </iframe> """.format(self.html)
325 from IPython.core.display import display, HTML
--> 326 display(HTML(iframe_html))
327
328 def persist(self):
/usr/lib/python3.8/site-packages/IPython/core/display.py in init(self, data, url, filename, metadata)
716 if warn():
717 warnings.warn("Consider using IPython.display.IFrame instead")
--> 718 super(HTML, self).init(data=data, url=url, filename=filename, metadata=metadata)
719
720 def repr_html(self):
/usr/lib/python3.8/site-packages/IPython/core/display.py in init(self, data, url, filename, metadata)
628 self.metadata = {}
629
--> 630 self.reload()
631 self._check_data()
632
/usr/lib/python3.8/site-packages/IPython/core/display.py in reload(self)
653 """Reload the raw data from file or URL."""
654 if self.filename is not None:
--> 655 with open(self.filename, self._read_flags) as f:
656 self.data = f.read()
657 elif self.url is not None:
OSError: [Errno 91] File name too long: ' <iframe srcdoc='\n\n\n \n <title>Cog Graph</title>\n <style type="text/css">\n body {\n padding: 0;\n margin: 0;\n width: 100%;!important; \n height: 100%;!important; \n }\n\n #cog-graph-view {\n width: 700px;\n height: 700px;\n }\n </style>\n\n\n <script\n type="text/javascript"\n src="https://cdnjs.cloudflare.com/ajax/libs/vis/4.21.0/vis.min.js"\n ></script>\n \n \n \n
\n\n <script type="text/javascript">\n\n results =[{"id": "fred", "from": "bob", "to": "fred"}, {"id": "fred", "from": "emily", "to": "fred"}, {"id": "dani", "from": "charlie", "to": "dani"}, {"id": "bob", "from": "charlie", "to": "bob"}, {"id": "bob", "from": "alice", "to": "bob"}, {"id": "greg", "from": "dani", "to": "greg"}, {"id": "bob", "from": "dani", "to": "bob"}, {"id": "greg", "from": "fred", "to": "greg"}] \n\n var nodes = new vis.DataSet();\n var edges = new vis.DataSet();\n for (let i = 0; i < results.length; i++) {\n res = results[i];\n nodes.update({\n id: res.from,\n label: res.from\n });\n nodes.update({\n id: res.to,\n label: res.to\n });\n edges.update({\n from: res.from,\n to: res.to\n });\n\n }\n\n var container = document.getElementById("cog-graph-view");\n var data = {\n nodes: nodes,\n edges: edges,\n };\n var options = {\n nodes: {\n font: {\n size: 20,\n color: "black"\n },\n color: "#46944f",\n shape: "dot",\n widthConstraint: 200,\n\n },\n edges: {\n font: "12px arial #ff0000",\n scaling: {\n label: true,\n },\n shadow: true,\n smooth: true,\n arrows: { to: {enabled: true}}\n },\n physics: {\n barnesHut: {\n gravitationalConstant: -30000\n },\n stabilization: {\n iterations: 1000\n },\n }\n\n };\n var network = new vis.Network(container, data, options);\n </script>\n \n\n\n' width="700" height="700"> </iframe> 'Thanks
The text was updated successfully, but these errors were encountered: