On Tue, Aug 14, 2018 at 12:08:04AM +0200, Petter Reinholdtsen wrote:
>
> Package: plotly
> Version: 1.13.0+dfsg-1
>
> I tested plotly for the first time, and it fail to work. I started with
> an example from https://plot.ly/python/line-charts/ >, which fail
> to work because I do not have login credentials on some cloud service.
> As I want my graph to work locally, not depend on some cloud service, I
> tried to modify the example to draw using the offline mode. When I run
> the modified script, I get this error:
>
> Traceback (most recent call last):
> File "./infograph", line 35, in
> py.plot(data, filename='line-mode.html')
> File "/usr/lib/python3/dist-packages/plotly/offline/offline.py", line 461,
> in plot
> get_plotlyjs(),
> File "/usr/lib/python3/dist-packages/plotly/offline/offline.py", line 49,
> in get_plotlyjs
> plotlyjs = resource_string('plotly', path).decode('utf-8')
> File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 1210,
> in resource_string
> self, resource_name
> File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 1452,
> in get_resource_string
> return self._get(self._fn(self.module_path, resource_name))
> File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 1572,
> in _get
> with open(path, 'rb') as stream:
> FileNotFoundError: [Errno 2] No such file or directory:
> '/usr/lib/python3/dist-packages/plotly/package_data/plotly.min.js'
>
> Is there a file missing in the binary package?
>
> This is the script I am using:
>
> #!/usr/bin/python3
>
> import plotly.offline.offline as py
> import plotly.graph_objs as go
>
> # Create random data with numpy
> import numpy as np
>
> N = 100
> random_x = np.linspace(0, 1, N)
> random_y0 = np.random.randn(N)+5
> random_y1 = np.random.randn(N)
> random_y2 = np.random.randn(N)-5
>
> # Create traces
> trace0 = go.Scatter(
> x = random_x,
> y = random_y0,
> mode = 'lines',
> name = 'lines'
> )
> trace1 = go.Scatter(
> x = random_x,
> y = random_y1,
> mode = 'lines+markers',
> name = 'lines+markers'
> )
> trace2 = go.Scatter(
> x = random_x,
> y = random_y2,
> mode = 'markers',
> name = 'markers'
> )
> data = [trace0, trace1, trace2]
> py.plot(data, filename='line-mode.html')
>
>
> --
> Happy hacking
> Petter Reinholdtsen
Hi Petter,
Unfortunately the current version in Stable does not work with the offline mode
since only the minified version javascript was provided by upstream which does
not comply with de DFSG ยง2.
I have uploaded a version (2.1.0+dfsg-1~bpo9+1) with the unminified javascript
to
Stretch Backports repository[1], This version works with offline mode
Best Regards
[1]: https://packages.debian.org/source/stretch-backports/plotly
signature.asc
Description: PGP signature