plotly / plotly/plotly.R

orca error

Open
#1,863 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
R
Stars
2.7k
Forks
641
PR merge metrics
No merged PRs in 30d

Description

Hi Carson Sievert,

An error occur when I want to export graph using orca.

# help orca example
p <- plot_ly(z = ~volcano) %>% add_surface()
orca(p, "surface-plot.svg")

I obtain these R output

Erreur : The orca command-line utility is required for this functionality.
Please follow the installation instructions here -- https://github.com/plotly/orca#installation

which come from your orca_available() function

orca_available <- function() {
  if (Sys.which("orca") == "" || !correct_orca()) {
    stop(
      "The orca command-line utility is required for this functionality.\n\n",
      "Please follow the installation instructions here -- https://github.com/plotly/orca#installation",
      call. = FALSE
    )
  }
  
  TRUE
}

but, as shown below, orca is available on my computer

$ orca
Plotly's image-exporting utilities

  Usage: orca [--version] [--help] <command> [<args>]

  Available commands:
  - graph [or plotly-graph, plotly_graph]
    Generates an image of plotly graph from inputted plotly.js JSON attributes.
    For more info, run `orca graph --help`.
  - serve [or server]
    Boots up a server with one route per available export component
    For more info, run `orca serve --help`.

The bug come from correct_orca() (orca.R, lines 201-210), with As shown below, processx::run() don't export the first line "Plotly's image-exporting utilities" of stdout which is use by grepl to return TRUE.

# orca.R lines 207-210
correct_orca <- function() {
  orca_help <- processx::run("orca", "-h")
  grepl("plotly", orca_help[["stdout"]], ignore.case = TRUE)
}

# processx line
> processx::run("orca", "-h")
$status
[1] 0

$stdout
[1] "Utilisation : orca [-h] [-v] [-r] [-s] [-l] [-e OPTION] [-d OPTION] [-p NOM]\n                   [-u RÉPERTOIRE] [--debug-file FICHIER] [--debug]\n\nParamètres facultatifs:\n  -h, --help                    Montrer ce message d’aide et quitter\n  -v, --version                 3.36.2\n  -r, --replace                 Remplace une instance actuellement lancée de\n                                ce lecteur d’écran\n  -s, --setup                   Définit les préférences utilisateur (mode\n                                graphique)\n  -l, --list-apps               Affiche les applications lancées connues\n  -e OPTION, --enable OPTION    Force l’utilisation de l’option\n  -d OPTION, --disable OPTION   Empêche l’utilisation de l’option\n  -p NOM, --profile NOM         Charge le profil\n  -u RÉPERTOIRE, --user-prefs RÉPERTOIRE\n                                Utilise un répertoire alternatif pour les\n                                préférences des utilisateurs\n  --debug-file FICHIER          Envoie la sortie de débogage dans le fichier\n                                indiqué\n  --debug                       Envoie la sortie de débogage dans debug-AAAA-\n                                MM-JJ-HH:MM:SS.out\n\nRapportez les bogues à orca-list@gnome.org.\n"

$stderr
[1] ""

$timeout
[1] FALSE

Maybe you can remove correct_orca() function to prevent this bug, and because you test orca availability with Sys.which("orca") on orca_available()

Sincerely,

Aurélien BRIONNE,

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in orca.R around lines 201-210 and reproduce the reported orca() example with the documented processx::run("orca", "-h") output. Check how correct_orca() validates the command and how orca_available() uses that result. Done means an installed Orca executable is recognized even when its help output is localized, while unavailable Orca still produces the intended error.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
data-visualization
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
50/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.