Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

On Ubuntu 14.04 only "Folder select" works while "File select" and "Save file" do not work using shinyFiles/inst/example #15

Closed
SamoPP opened this issue Mar 27, 2015 · 15 comments
Labels

Comments

@SamoPP
Copy link

@SamoPP SamoPP commented Mar 27, 2015

On Ubuntu 14.04 only "Folder select" works while "File select" and "Save file" do not work using shinyFiles/inst/example . All the controls in "File select" and "Save file" examples are empty, nothing to choose from,...

@thomasp85
Copy link
Owner

@thomasp85 thomasp85 commented Mar 27, 2015

That seems strange. What browser are you using? Can I get a screenshot of the issue as 'all controls' is a bit ambiguous:-)

Den 27/03/2015 kl. 02.01 skrev SamoPP notifications@github.com:

On Ubuntu 14.04 only "Folder select" works while "File select" and "Save file" do not work using shinyFiles/inst/example . All the controls in "File select" and "Save file" examples are empty, nothing to choose from,...


Reply to this email directly or view it on GitHub.

@thomasp85
Copy link
Owner

@thomasp85 thomasp85 commented Mar 27, 2015

I cannot replicate any problems on Ubuntu with either Chrome or Firefox. I will need a more detailed description of the issue as well as your system setup in order to investigate further...

@SamoPP
Copy link
Author

@SamoPP SamoPP commented Mar 27, 2015

Hi. I pulled latest code from github a few minutes ago and rebuild the shinyFiles package. So, here are the screenshots (I use Firefox 37. on Ubuntu 14.4):

file select error
folder select ok
save file error

My sessionInfo():

sessionInfo()
R version 3.1.3 (2015-03-09)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 14.04.2 LTS

locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=en_US.UTF-8
[9] LC_ADDRESS=en_US.UTF-8 LC_TELEPHONE=en_US.UTF-8
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=en_US.UTF-8

attached base packages:
[1] stats graphics grDevices utils datasets methods base

other attached packages:
[1] shinyFiles_0.6.1 shiny_0.11.1.9003 rj_2.0.2-2

loaded via a namespace (and not attached):
[1] digest_0.6.4 htmltools_0.2.6 httpuv_1.3.2 jsonlite_0.9.10
[5] mime_0.2 R6_2.0.0.9000 Rcpp_0.11.2 rj.gd_2.0.0-1
[9] RJSONIO_1.2-0.2 tools_3.1.3 xtable_1.7-3

@SamoPP
Copy link
Author

@SamoPP SamoPP commented Mar 28, 2015

Actually, doing some more testing, Folder select is also not working. If I try and click on Volumes item in the drop down box (see picture above) app freezes.

Also, when I try and click the "up arrow" in "File select" app crashes and this the error:
Warning: Unhandled error in observer: subscript out of bounds
observe({
dir <- input[[paste0(id, "-modal")]]
if (is.null(dir) || is.na(dir)) {
dir <- list(dir = "")
}
else {
dir <- list(dir = dir$path, root = dir$root)
}
dir$dir <- do.call(file.path, as.list(dir$dir))
newDir <- do.call("fileGet", dir)
if (!identical(currentDir, newDir)) {
currentDir <<- newDir
session$sendCustomMessage("shinyFiles", list(id = id,
dir = newDir))
}
invalidateLater(updateFreq, session)
})

@thomasp85
Copy link
Owner

@thomasp85 thomasp85 commented Mar 28, 2015

This seems very strange and appears to be specific to your system. Have you tried to open the app in another browser? Can you report on whether the issue persist in both Chrome and Firefox?

Den 28/03/2015 kl. 12:24 skrev SamoPP notifications@github.com:

Actually, doing some more testing, Folder select is also not working. If I try and click on Volumes item in the drop down box (see picture above) app freezes.

Also, when I try and click the "up arrow" in "File select" app crashes and this the error:
Warning: Unhandled error in observer: subscript out of bounds
observe({
dir <- input[[paste0(id, "-modal")]]
if (is.null(dir) || is.na(dir)) {
dir <- list(dir = "")
}
else {
dir <- list(dir = dir$path, root = dir$root)
}
dir$dir <- do.call(file.path, as.list(dir$dir))
newDir <- do.call("fileGet", dir)
if (!identical(currentDir, newDir)) {
currentDir <<- newDir
session$sendCustomMessage("shinyFiles", list(id = id,
dir = newDir))
}
invalidateLater(updateFreq, session)
})


Reply to this email directly or view it on GitHub #15 (comment).

@thomasp85
Copy link
Owner

@thomasp85 thomasp85 commented Mar 28, 2015

Also, can you report the results of running getVolumes() in R

Den 28/03/2015 kl. 12:24 skrev SamoPP notifications@github.com:

Actually, doing some more testing, Folder select is also not working. If I try and click on Volumes item in the drop down box (see picture above) app freezes.

Also, when I try and click the "up arrow" in "File select" app crashes and this the error:
Warning: Unhandled error in observer: subscript out of bounds
observe({
dir <- input[[paste0(id, "-modal")]]
if (is.null(dir) || is.na(dir)) {
dir <- list(dir = "")
}
else {
dir <- list(dir = dir$path, root = dir$root)
}
dir$dir <- do.call(file.path, as.list(dir$dir))
newDir <- do.call("fileGet", dir)
if (!identical(currentDir, newDir)) {
currentDir <<- newDir
session$sendCustomMessage("shinyFiles", list(id = id,
dir = newDir))
}
invalidateLater(updateFreq, session)
})


Reply to this email directly or view it on GitHub #15 (comment).

@SamoPP
Copy link
Author

@SamoPP SamoPP commented Mar 29, 2015

So, I started fresh r session from terminal, then run getVolumes() (which returns function in my case which is strange), then again ran the example and opened in Chrome with same result as in Firefox - not working:
user@userVB:~$ R

R version 3.1.3 (2015-03-09) -- "Smooth Sidewalk"
Copyright (C) 2015 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

getVolumes()
Error: could not find function "getVolumes"
library(shinyFiles)
getVolumes()
function ()
{
osSystem <- Sys.info()["sysname"]
if (osSystem == "Darwin") {
volumes <- list.files("/Volumes/", full.names = T)
names(volumes) <- basename(volumes)
}
else if (osSystem == "Linux") {
volumes <- c(Computer = "/")
media <- list.files("/media/", full.names = T)
names(media) <- basename(media)
volumes <- c(volumes, media)
}
else if (osSystem == "Windows") {
volumes <- system("wmic logicaldisk get Caption", intern = T)
volumes <- sub(" *\r$", "", volumes)
keep <- !tolower(volumes) %in% c("caption", "")
volumes <- volumes[keep]
volNames <- system("wmic logicaldisk get VolumeName",
intern = T)
volNames <- sub(" *\r$", "", volNames)
volNames <- volNames[keep]
volNames <- paste0(volNames, " (", volumes, ")")
names(volumes) <- volNames
}
else {
stop("unsupported OS")
}
if (!is.null(exclude)) {
volumes <- volumes[!names(volumes) %in% exclude]
}
volumes
}
<bytecode: 0x25df558>
<environment: 0x25f5738>
shinyFilesExample()
Loading required package: shiny

Listening on http://127.0.0.1:4532
Warning: Unhandled error in observer: subscript out of bounds
observe({
dir <- input[[paste0(id, "-modal")]]
if (is.null(dir) || is.na(dir)) {
dir <- list(dir = "")
}
else {
dir <- list(dir = dir$path, root = dir$root)
}
dir$dir <- do.call(file.path, as.list(dir$dir))
newDir <- do.call("fileGet", dir)
if (!identical(currentDir, newDir)) {
currentDir <<- newDir
session$sendCustomMessage("shinyFiles", list(id = id,
dir = newDir))
}
invalidateLater(updateFreq, session)
})

@thomasp85
Copy link
Owner

@thomasp85 thomasp85 commented Mar 29, 2015

My bad for being imprecise. Can you run:

library(shinyFiles)
volumes <- getVolumes()
volumes()

and send me the results?

On 29 Mar 2015, at 03:52, SamoPP notifications@github.com wrote:

So, I started fresh r session from terminal, then run getVolumes() (which returns function in my case which is strange), then again ran the example and opened in Chrome with same result as in Firefox - not working:
user@userVB:~$ R

R version 3.1.3 (2015-03-09) -- "Smooth Sidewalk"
Copyright (C) 2015 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

getVolumes()
Error: could not find function "getVolumes"
library(shinyFiles)
getVolumes()
function ()
{
osSystem <- Sys.info()["sysname"]
if (osSystem == "Darwin") {
volumes <- list.files("/Volumes/", full.names = T)
names(volumes) <- basename(volumes)
}
else if (osSystem == "Linux") {
volumes <- c(Computer = "/")
media <- list.files("/media/", full.names = T)
names(media) <- basename(media)
volumes <- c(volumes, media)
}
else if (osSystem == "Windows") {
volumes <- system("wmic logicaldisk get Caption", intern = T)
volumes <- sub(" *\r$", "", volumes)
keep <- !tolower(volumes) %in% c("caption", "")
volumes <- volumes[keep]
volNames <- system("wmic logicaldisk get VolumeName",
intern = T)
volNames <- sub(" *\r$", "", volNames)
volNames <- volNames[keep]
volNames <- paste0(volNames, " (", volumes, ")")
names(volumes) <- volNames
}
else {
stop("unsupported OS")
}
if (!is.null(exclude)) {
volumes <- volumes[!names(volumes) %in% exclude]
}
volumes
}

shinyFilesExample()
Loading required package: shiny

Listening on http://127.0.0.1:4532 http://127.0.0.1:4532/
Warning: Unhandled error in observer: subscript out of bounds
observe({
dir <- input[[paste0(id, "-modal")]]
if (is.null(dir) || is.na(dir)) {
dir <- list(dir = "")
}
else {
dir <- list(dir = dir$path, root = dir$root)
}
dir$dir <- do.call(file.path, as.list(dir$dir))
newDir <- do.call("fileGet", dir)
if (!identical(currentDir, newDir)) {
currentDir <<- newDir
session$sendCustomMessage("shinyFiles", list(id = id,
dir = newDir))
}
invalidateLater(updateFreq, session)
})


Reply to this email directly or view it on GitHub #15 (comment).

@SamoPP
Copy link
Author

@SamoPP SamoPP commented Mar 29, 2015

volumes <- getVolumes()
volumes()
Computer apt
"/" "/media//apt"
dvd userx
"/media//dvd" "/media//userx"
sf_0000-0001 sf_backup_22.08.2011
"/media//sf_0000-0001" "/media//sf_backup_22.08.2011"
sf_userx_dev sf_tmp
"/media//sf_userx_dev" "/media//sf_tmp"

Note: I replaced my original user with userx... I am using VirtualBox Ubuntu guest on Ubuntu host...

@thomasp85
Copy link
Owner

@thomasp85 thomasp85 commented Mar 29, 2015

It seems to be doing what it should be doing - Do you know how to access the developer tools in Chrome?

If so, can you see if there are any errors occuring when you summon a file chooser?

On 29 Mar 2015, at 13:37, SamoPP notifications@github.com wrote:

volumes <- getVolumes()
volumes()
Computer apt
"/" "/media//apt"
dvd userx
"/media//dvd" "/media//userx"
sf_0000-0001 sf_backup_22.08.2011
"/media//sf_0000-0001" "/media//sf_backup_22.08.2011"
sf_userx_dev sf_tmp
"/media//sf_userx_dev" "/media//sf_tmp"

@SamoPP
Copy link
Author

@SamoPP SamoPP commented Mar 29, 2015

Here are the errors in Chrome when I press select file:
Uncaught TypeError: undefined is not a functionshinyFiles.js:596 populateFileChoosershinyFiles.js:563 createFileChoosershinyFiles.js:1710 (anonymous function)jquery.min.js:3 n.event.dispatchjquery.min.js:3 r.handle

@SamoPP
Copy link
Author

@SamoPP SamoPP commented Jun 8, 2015

Hi Thomas,

Any update on this issue? How can I help you debug this?

Best regards,
Samo.

@thomasp85
Copy link
Owner

@thomasp85 thomasp85 commented Jun 8, 2015

Sorry for being slow on this. With the latest update of Shiny (0.12) they have introduced some bugs that breaks shinyFiles. If you haven't updated yet (or can downgrade somehow) you can help if you know your way around the Chrome debugger. If so can you pinpoint where the code expects a function but gets undefined...

@SamoPP
Copy link
Author

@SamoPP SamoPP commented Jun 11, 2015

Good news. After installing latest version of shiny from github this magically works now. Thanks.

There is just one thing I do not understand whether it is a bug or a feature with folder selection: I can only select folders on the left pane (under "Directories") from the tree but not from the right pane ("Content")... It would be nice that if clicked on the folder on the right pane ("Content") that selected folder would show as selection result...

@thomasp85
Copy link
Owner

@thomasp85 thomasp85 commented Jun 12, 2015

That's good to hear. There have been some bugs in the latest version of Shiny that affected shinyFiles but I didn't expect them to cause what you described. Glad it solved itself out.

Regarding the functionality of the dirchooser, the right window is thought as a glimpse into the selected folder and not a navigation tool. The idea is that the user could be reassured that it was indeed the correct folder they had chosen. In that vein I would call it a 'feature' :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants