I am trying to run through the d3py example code available in the d3py readme file (see link below), and am receiving the following error:
https://github.com/mikedewar/d3py/blob/master/README.md
(python 2.7.3 on 32-bit Windows)
>>> # instantiate the figure object
>>> fig = d3py.Figure(df, name="basic_example", width=300, height=300)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "build\bdist.win32\egg\d3py\d3py.py", line 97, in __init__
IOError: [Errno 2] No such file or directory: 'static/d3.js'
>>>
I installed the d3py package by using the following command in PowerShell:
easy_install https://github.com/mikedewar/d3py/tarball/master
and, importing the package within a python session (i.e. import d3py) does not result in any errors. What can I do to make the example code work?
So d3py is a really raw project, and to be honest our setup.py sucks quite hard. This means you either need to make a pull request with some fixes to setup.py or you need to make a folder called static in your project folder and make sure that d3.js is inside the folder.
On the assumption that the second option is the one you’ll use, just to make it clear:
In a terminal, change to the directory that holds your project, like
Make a folder called static:
then move into that directory and get the d3.js file from the repo:
Apologies for this terrible hack! d3 based plotting from inside python is definitely going to happen, but maybe not with this project!
Having said that, d3py will work as advertised once you get it to run! A really popular use case of d3py, which we hadn’t quite realised would be popular, is that people use it to quickly mock up some javascript, using the output of d3py as a starting point for fancier visualisations.