folder selection with shinyFiles stopped working with the update










2















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...










share|improve this question
























  • 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















2















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...










share|improve this question
























  • 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













2












2








2


2






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...










share|improve this question
















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






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 16 '18 at 0:52







kintany

















asked Nov 15 '18 at 20:34









kintanykintany

144111




144111












  • 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

















  • 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
















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












1 Answer
1






active

oldest

votes


















2














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.






share|improve this answer






















    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
    );



    );













    draft saved

    draft discarded


















    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









    2














    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.






    share|improve this answer



























      2














      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.






      share|improve this answer

























        2












        2








        2







        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.






        share|improve this answer













        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.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 15 '18 at 21:15









        kintanykintany

        144111




        144111





























            draft saved

            draft discarded
















































            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.




            draft saved


            draft discarded














            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





















































            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







            Popular posts from this blog

            27

            Top Tejano songwriter Luis Silva dead of heart attack at 64

            Category:Rhetoric