Skip to content

Commit 1e4e541

Browse files
authored
Improve safety of RFormatter.importable (#353)
Previously, if the system was missing Rscript, an exception would be thrown from RFormatter.importable. In some configurations, this exception caused a noisy and annoying error message, "Unable to find default formatters to use"
1 parent 55a9d04 commit 1e4e541

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

jupyterlab_code_formatter/formatters.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,9 @@ def package_name(self) -> str:
361361

362362
@property
363363
def importable(self) -> bool:
364+
if not command_exist("Rscript"):
365+
return False
366+
364367
package_location = subprocess.run(
365368
["Rscript", "-e", f"cat(system.file(package='{self.package_name}'))"],
366369
capture_output=True,

0 commit comments

Comments
 (0)