folder selection with shinyFiles stopped working with the update
A year ago I was building a Shiny app and was asking how to display the default folder with shinyFiles.
At this time, with the help of commentators, I built a reproducible example, which was working:
library(shiny)
library(shinyFiles)
ui <- fluidPage( # Application title
mainPanel(
shinyDirButton("dir", "Input directory", "Upload"),
verbatimTextOutput("dir", placeholder = TRUE)
))
server <- function(input, output)
shinyDirChoose(
input,
'dir',
roots = c(home = '~'),
filetypes = c('', 'txt', 'bigWig', "tsv", "csv", "bw")
)
global <- reactiveValues(datapath = getwd())
dir <- reactive(input$dir)
output$dir <- renderText(
global$datapath
)
observeEvent(ignoreNULL = TRUE,
eventExpr =
input$dir
,
handlerExpr =
home <- normalizePath("~")
global$datapath <-
file.path(home, paste(unlist(dir()$path[-1]), collapse = .Platform$file.sep))
)
# Run the application
shinyApp(ui = ui, server = server)
Now it's time to update my Shiny app, I updated the R version and a number of packages and it stopped working. I'm getting the following error:
Warning: Error in $: $ operator is invalid for atomic vectors
75: unlist
72: observeEventHandler
1: shiny::runApp
I can't figure out what is wrong now. I tried installing the previous version of shinyFiles but surprisingly still getting the same error. So it must be some other package.
I would appreciate any ideas!
UPD. Adding req(is.list(input$dir)) fixed the problem, now I can the file selection works in the app but if I run it from Docker, I can't see the shared directory...
r docker shiny
add a comment |
A year ago I was building a Shiny app and was asking how to display the default folder with shinyFiles.
At this time, with the help of commentators, I built a reproducible example, which was working:
library(shiny)
library(shinyFiles)
ui <- fluidPage( # Application title
mainPanel(
shinyDirButton("dir", "Input directory", "Upload"),
verbatimTextOutput("dir", placeholder = TRUE)
))
server <- function(input, output)
shinyDirChoose(
input,
'dir',
roots = c(home = '~'),
filetypes = c('', 'txt', 'bigWig', "tsv", "csv", "bw")
)
global <- reactiveValues(datapath = getwd())
dir <- reactive(input$dir)
output$dir <- renderText(
global$datapath
)
observeEvent(ignoreNULL = TRUE,
eventExpr =
input$dir
,
handlerExpr =
home <- normalizePath("~")
global$datapath <-
file.path(home, paste(unlist(dir()$path[-1]), collapse = .Platform$file.sep))
)
# Run the application
shinyApp(ui = ui, server = server)
Now it's time to update my Shiny app, I updated the R version and a number of packages and it stopped working. I'm getting the following error:
Warning: Error in $: $ operator is invalid for atomic vectors
75: unlist
72: observeEventHandler
1: shiny::runApp
I can't figure out what is wrong now. I tried installing the previous version of shinyFiles but surprisingly still getting the same error. So it must be some other package.
I would appreciate any ideas!
UPD. Adding req(is.list(input$dir)) fixed the problem, now I can the file selection works in the app but if I run it from Docker, I can't see the shared directory...
r docker shiny
The problem seems to be thedir()$path[-1]. I don't see any documentation for a$pathproperty for the input object. Where did that come from?
– MrFlick
Nov 15 '18 at 20:45
I'm trying to find a reference now but I can't... Weird.
– kintany
Nov 15 '18 at 21:13
add a comment |
A year ago I was building a Shiny app and was asking how to display the default folder with shinyFiles.
At this time, with the help of commentators, I built a reproducible example, which was working:
library(shiny)
library(shinyFiles)
ui <- fluidPage( # Application title
mainPanel(
shinyDirButton("dir", "Input directory", "Upload"),
verbatimTextOutput("dir", placeholder = TRUE)
))
server <- function(input, output)
shinyDirChoose(
input,
'dir',
roots = c(home = '~'),
filetypes = c('', 'txt', 'bigWig', "tsv", "csv", "bw")
)
global <- reactiveValues(datapath = getwd())
dir <- reactive(input$dir)
output$dir <- renderText(
global$datapath
)
observeEvent(ignoreNULL = TRUE,
eventExpr =
input$dir
,
handlerExpr =
home <- normalizePath("~")
global$datapath <-
file.path(home, paste(unlist(dir()$path[-1]), collapse = .Platform$file.sep))
)
# Run the application
shinyApp(ui = ui, server = server)
Now it's time to update my Shiny app, I updated the R version and a number of packages and it stopped working. I'm getting the following error:
Warning: Error in $: $ operator is invalid for atomic vectors
75: unlist
72: observeEventHandler
1: shiny::runApp
I can't figure out what is wrong now. I tried installing the previous version of shinyFiles but surprisingly still getting the same error. So it must be some other package.
I would appreciate any ideas!
UPD. Adding req(is.list(input$dir)) fixed the problem, now I can the file selection works in the app but if I run it from Docker, I can't see the shared directory...
r docker shiny
A year ago I was building a Shiny app and was asking how to display the default folder with shinyFiles.
At this time, with the help of commentators, I built a reproducible example, which was working:
library(shiny)
library(shinyFiles)
ui <- fluidPage( # Application title
mainPanel(
shinyDirButton("dir", "Input directory", "Upload"),
verbatimTextOutput("dir", placeholder = TRUE)
))
server <- function(input, output)
shinyDirChoose(
input,
'dir',
roots = c(home = '~'),
filetypes = c('', 'txt', 'bigWig', "tsv", "csv", "bw")
)
global <- reactiveValues(datapath = getwd())
dir <- reactive(input$dir)
output$dir <- renderText(
global$datapath
)
observeEvent(ignoreNULL = TRUE,
eventExpr =
input$dir
,
handlerExpr =
home <- normalizePath("~")
global$datapath <-
file.path(home, paste(unlist(dir()$path[-1]), collapse = .Platform$file.sep))
)
# Run the application
shinyApp(ui = ui, server = server)
Now it's time to update my Shiny app, I updated the R version and a number of packages and it stopped working. I'm getting the following error:
Warning: Error in $: $ operator is invalid for atomic vectors
75: unlist
72: observeEventHandler
1: shiny::runApp
I can't figure out what is wrong now. I tried installing the previous version of shinyFiles but surprisingly still getting the same error. So it must be some other package.
I would appreciate any ideas!
UPD. Adding req(is.list(input$dir)) fixed the problem, now I can the file selection works in the app but if I run it from Docker, I can't see the shared directory...
r docker shiny
r docker shiny
edited Nov 16 '18 at 0:52
kintany
asked Nov 15 '18 at 20:34
kintanykintany
144111
144111
The problem seems to be thedir()$path[-1]. I don't see any documentation for a$pathproperty for the input object. Where did that come from?
– MrFlick
Nov 15 '18 at 20:45
I'm trying to find a reference now but I can't... Weird.
– kintany
Nov 15 '18 at 21:13
add a comment |
The problem seems to be thedir()$path[-1]. I don't see any documentation for a$pathproperty for the input object. Where did that come from?
– MrFlick
Nov 15 '18 at 20:45
I'm trying to find a reference now but I can't... Weird.
– kintany
Nov 15 '18 at 21:13
The problem seems to be the
dir()$path[-1]. I don't see any documentation for a $path property for the input object. Where did that come from?– MrFlick
Nov 15 '18 at 20:45
The problem seems to be the
dir()$path[-1]. I don't see any documentation for a $path property for the input object. Where did that come from?– MrFlick
Nov 15 '18 at 20:45
I'm trying to find a reference now but I can't... Weird.
– kintany
Nov 15 '18 at 21:13
I'm trying to find a reference now but I can't... Weird.
– kintany
Nov 15 '18 at 21:13
add a comment |
1 Answer
1
active
oldest
votes
Ok, just got a reply from shinyFiles developers: https://github.com/thomasp85/shinyFiles/issues/109#issuecomment-439185038
Inserting req(is.list(input$dir)) fixed the problem.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53327513%2ffolder-selection-with-shinyfiles-stopped-working-with-the-update%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Ok, just got a reply from shinyFiles developers: https://github.com/thomasp85/shinyFiles/issues/109#issuecomment-439185038
Inserting req(is.list(input$dir)) fixed the problem.
add a comment |
Ok, just got a reply from shinyFiles developers: https://github.com/thomasp85/shinyFiles/issues/109#issuecomment-439185038
Inserting req(is.list(input$dir)) fixed the problem.
add a comment |
Ok, just got a reply from shinyFiles developers: https://github.com/thomasp85/shinyFiles/issues/109#issuecomment-439185038
Inserting req(is.list(input$dir)) fixed the problem.
Ok, just got a reply from shinyFiles developers: https://github.com/thomasp85/shinyFiles/issues/109#issuecomment-439185038
Inserting req(is.list(input$dir)) fixed the problem.
answered Nov 15 '18 at 21:15
kintanykintany
144111
144111
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53327513%2ffolder-selection-with-shinyfiles-stopped-working-with-the-update%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
The problem seems to be the
dir()$path[-1]. I don't see any documentation for a$pathproperty for the input object. Where did that come from?– MrFlick
Nov 15 '18 at 20:45
I'm trying to find a reference now but I can't... Weird.
– kintany
Nov 15 '18 at 21:13