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

Help with "Error in rethrow_call" #261

Closed
rempsyc opened this issue Jul 31, 2020 · 19 comments · Fixed by #265
Closed

Help with "Error in rethrow_call" #261

rempsyc opened this issue Jul 31, 2020 · 19 comments · Fixed by #265
Labels
bug an unexpected problem or unintended behavior

Comments

@rempsyc
Copy link

rempsyc commented Jul 31, 2020

I was redirected here from an error with the webshot package linked to processx: wch/webshot#97

After installing and loading:

install.packages("webshot")
webshot::install_phantomjs()
library(webshot)

I run:

example(webshot)

Or the examples in the readme.md:

webshot("https://www.r-project.org/", "r.png")

And I consistently get:

Error in rethrow_call(c_processx_exec, command, c(command, args), stdin,  : 
  Command 'C:/Users/username/Documents/R/win-library/3.6/processx/bin/x64/supervisor.exe' not found @win/processx.c:983 (processx_exec)
Type .Last.error.trace to see where the error occured

I was told to try this rather simple processx command:

> process$new("dir", "hello", supervise = TRUE)

Which outputs a similar error.

Error in rethrow_call(c_processx_exec, command, c(command, args), stdin,  : 
  Command 'dir' not found @win/processx.c:994 (processx_exec)
Type .Last.error.trace to see where the error occured

> .Last.error.trace

 Stack trace:

 1. process$new("dir", "hello", supervise = TRUE)
 2. .subset2(public_bind_env, "initialize")(...)
 3. processx:::process_initialize(self, private, command, args, stdin,  ...
 4. rethrow_call(c_processx_exec, command, c(command, args), stdin,  ...

 x Command 'dir' not found @win/processx.c:994 (processx_exec) 

I reinstalled processx in a new R session, but same error. So I manually uninstalled from RStudio and reinstalled again, but same thing.

I wonder whether it could be due to my username having spaces and accents (though I cannot change it). I know it has given me some trouble with other packages in the past.

@gaborcsardi
Copy link
Member

My guess is that it is because of the accents indeed. Maybe you could map a windows drive, e.g. H: to your home directory with the subst command as a workaround.

@rempsyc
Copy link
Author

rempsyc commented Jul 31, 2020

How would I go about doing that?

@gaborcsardi
Copy link
Member

@rempsyc
Copy link
Author

rempsyc commented Jul 31, 2020

I mean I did create a virtual directory H: pointing to my home directory with the subst command. My question is rather, how can I tell processx in R to use H: rather than C:/ ? Because even after doing that I still experience the same error.

@gaborcsardi
Copy link
Member

You can set your library path to H: and install your packages there. I don't know if you need to reinstall the packages or just point to them through H:.

(I did not test this, hopefully it works.)

@rempsyc
Copy link
Author

rempsyc commented Jul 31, 2020

Ok got you. I did uninstall processx then reinstalled in "H:/Documents/R/win-library/3.6", still same result. I must say I had already tried installing in the common directory before: "C:/Program Files/R/R-3.6.1/library" with same result.

@gaborcsardi
Copy link
Member

I am sorry for the question, but are you are you sure that you are loading the package from that directory? It is easy to mix them up if you have multiple directories.

@rempsyc
Copy link
Author

rempsyc commented Jul 31, 2020

No, that's a good question. I had only assumed I was loading from the correct directory since I always uninstalled first. But no luck when specifying from where to load with lib.loc:

> library("processx", lib.loc="H:/Documents/R/win-library/3.6")
Warning message:
package ‘processx’ was built under R version 3.6.3 

> process$new("dir", "hello", supervise = TRUE)
Error in rethrow_call(c_processx_exec, command, c(command, args), stdin,  : 
  Command 'dir' not found @win/processx.c:994 (processx_exec)
Type .Last.error.trace to see where the error occured

@gaborcsardi
Copy link
Member

OK, this is a bug, anyway, let me try to fix it.

@gaborcsardi gaborcsardi added the bug an unexpected problem or unintended behavior label Jul 31, 2020
@rempsyc
Copy link
Author

rempsyc commented Jul 31, 2020

Do you think it might be due to having R version 3.6.1 while processx was built under 3.6.3? Do you want me to install latest version and test again?

@gaborcsardi
Copy link
Member

No, that is very unlikely.

@gaborcsardi
Copy link
Member

@rempsyc Which non ASCII character(s) do you have in your path?

@rempsyc
Copy link
Author

rempsyc commented Aug 5, 2020

French accents, "é", e.g, Sébastien Gagné

@gaborcsardi
Copy link
Member

Which version of processx is this? What is your system locale? E.g. the output of

library(processx)
sessionInfo()

would be good.

@rempsyc
Copy link
Author

rempsyc commented Aug 5, 2020

> library(processx)
Warning message:
package ‘processx’ was built under R version 3.6.3

> sessionInfo()
R version 3.6.1 (2019-07-05)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 18362)

Matrix products: default

locale:
[1] LC_COLLATE=English_Canada.1252  LC_CTYPE=English_Canada.1252   
[3] LC_MONETARY=English_Canada.1252 LC_NUMERIC=C                   
[5] LC_TIME=English_Canada.1252    

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

other attached packages:
[1] processx_3.4.3

loaded via a namespace (and not attached):
[1] compiler_3.6.1 tools_3.6.1    ps_1.3.3      

@gaborcsardi
Copy link
Member

R 3.6.x is not great for non-ASCII paths, unfortunately. There is a good chance that your problem is fixed in R 4.0.x, which has:

  • file.path() has some support for file paths not in the session encoding, e.g. with UTF-8 inputs in a non-UTF-8 locale the output is marked as UTF-8.
  • Most functions with file-path inputs will give an explicit error if a file-path input in a marked encoding cannot be translated (to the native encoding or in some cases on Windows to UTF-8), rather than translate to a different file path using escapes. Some (such as dir.exists(), file.exists(), file.access(), file.info(), list.files(), normalizePath() and path.expand()) treat this like any other non-existent file, often with a warning.

@rempsyc
Copy link
Author

rempsyc commented Aug 5, 2020

Great! I will try that and come back to you.

@rempsyc
Copy link
Author

rempsyc commented Aug 5, 2020

Ok, just updated R and RStudio. Same error (edit: for process$new("dir", "hello", supervise = TRUE)). Could it simply be that dir is also not a Windows executable like you pointed out in the other thread? Do you have any other command to make me try?

@rempsyc
Copy link
Author

rempsyc commented Aug 5, 2020

Actually, I just retried

library(webshot)
webshot("https://www.r-project.org/", "r.png")

And now it works! I guess because of the R update. And as for the dir command, maybe it simply didn't work because it's not a Windows executable as you said!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug an unexpected problem or unintended behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants