Closed bmchorse closed 7 years ago
Hi thanks a lot for reporting the issue! I don't often have the chance to test things on Windows and find the question of slash, backslash, double-backslash quite confusing. I will look into into it and try to fix it following your suggestions. In the meantime, you can always open the PyRate-generated R scripts and execute them line-by-line in R to get the plots. Cheers - Daniele
When I run plotting commands for PyRate, the R script saved to generate the PDF contains path formatting that does not work because of backslashes.
Platform: Windows 10 Python v2.7 R v3.4.0 Rstudio v1.0.143
Example: after running a trait covariance analysis, I call:
> python "./PyRate/PyRate.py" -plot2 "./Results/pyrate_mcmc_logs/occ_1_G_COV_marginal_rates.log"
This successfully creates a _RTT.R script. The call to pdf is written as follows (with the '...' representing a longer path of folders):In both base R and RStudio, this line gives the error:
Error: '\U' used without hex digits in character string starting "'C:\U"
Escaping by using
\\
instead of\
did not seem to work, but replacing with/
does work:The PyRate plot methods seem to intentionally use the backslash in this pdf() call when the system platform is Windows (or Microsoft), but it needs a little more of a workaround as the working directory will also use
\
when called.I solved the problem locally by modifying the code in PyRate.py at line 427 with the following:
But I am not sure if this is broadly applicable. Similar fixes are necessary for, e.g., PyRateContinuous.py.
Thanks!