Skip to content

Commit cf844be

Browse files
committed
Look for rsession in more paths
Fail explicitly if rsession isn't found
1 parent b1e9a27 commit cf844be

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

jupyter_rsession_proxy/__init__.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,22 @@ def _get_rsession_env(port):
5858
}
5959

6060
def _get_rsession_cmd(port):
61+
# Other paths rsession maybe in
62+
other_paths = [
63+
# When rstudio-server deb is installed
64+
'/usr/lib/rstudio-server/bin/rsession',
65+
# When just rstudio deb is installed
66+
'/usr/lib/rstudio/bin/rsession',
67+
]
6168
if shutil.which('rsession'):
6269
executable = 'rsession'
6370
else:
64-
# Default path for rsession if installed with the deb package
65-
executable = '/usr/lib/rstudio-server/bin/rsession'
71+
for op in other_paths:
72+
if os.path.exists(op):
73+
executable = op
74+
break
75+
else:
76+
raise FileNotFoundError('Can not find rsession in PATH')
6677

6778
return [
6879
executable,

0 commit comments

Comments
 (0)