I have browsed here some similar posts and realized that this error may result from vary reasons. So I still post my problem here. I am sorry that I am not able to provide a reproducible example, because I need to use some other local files (thousands of png files) in the code.
So here is the code:
library(shiny)
ui=fluidPage(
titlePanel('hello shiny'),
sidebarPanel(
textInput('ID',label='ID:'),actionButton('goButton',label='submit')
),
mainPanel(imageOutput('out'))
)
server <- function(input, output,session) {
fullnames=list.files(path = "/Users/u/Documents/myapp/www", pattern = ".png");
reactive({
input$ID=gsub(pattern = '\\.png','',fullnames)
}
);
output$out=renderImage(
{
filenames=normalizePath(file.path('/Users/u/Documents/myapp/www',paste(input$ID,'.png',sep='')));
list(src=filenames)
},
deleteFile = F
)
}
shinyApp(ui,server)
the error:
Listening on http://127.0.0.1:7453
Warning in normalizePath(file.path("/Users/u/Documents/myapp/www", :
path[1]="/Users/u/Documents/myapp/www/.png": No such file or directory
I am guessing something is wrong with the input, as the warning shows incomplete path. It still works locally, but not on server, with the same warning (error) on the server log. Any idea how to fix it? Thank you very much.