plotly / orca

Command line application for generating static images of interactive plotly charts
MIT License
294 stars 40 forks source link

Output error message when no display is available #219

Open scottwilson312 opened 5 years ago

scottwilson312 commented 5 years ago
#!/usr/bin/env node

const path = require('path')
const { spawn } = require('child_process')
const electronPath = require('electron')

const args = process.argv.slice(2)
const pathToMain = path.join(__dirname, 'orca_electron.js')
args.unshift(path.resolve(pathToMain))

spawn(electronPath, args, { stdio: 'inherit' })
root@mw-8479d67f8b-nxzdl:/usr/bin# orca
root@mw-8479d67f8b-nxzdl:/usr/bin# orca kcdjkajfd
root@mw-8479d67f8b-nxzdl:/usr/bin# node orca

I'm not familiar enough with node to know what's up. This is inside an Ubuntu docker. The script isn't erroring out, but it isn't producing any output.

antoinerg commented 5 years ago

Within a Docker container, one needs to run xvfb

Xvfb (short for X virtual framebuffer) is an in-memory display server for UNIX-like operating system (e.g., Linux). It enables you to run graphical applications without a display (e.g., browser tests on a CI server) while also having the ability to take screenshots.

I am working on releasing an official Docker image for Orca. Stay tune, it is coming very soon!

antoinerg commented 5 years ago

@scottwilson312 I went ahead and changed the title of the issue. I agree that the current behavior is not user-friendly at all... In the absence of a display, an error should be displayed to the user.

Thanks for reporting this!

scottwilson312 commented 5 years ago

Thanks for the response, much appreciated. I ended up getting it working with xvfb, however I needed to run the docker container as privileged.

I ended up adapting the dockerfile here https://hub.docker.com/r/cpsievert/plotly-orca/dockerfile

antoinerg commented 5 years ago

Similarly, we should output a friendlier error message when plotly.js cannot be found by the renderer as discussed in https://github.com/plotly/orca/issues/232