Fix Read-Only filesystem permission issue for log file
@@ -30,17 +30,21 @@ def main():
# 2. current working directory: "."
# 3. default temp directory for the OS (e.g. /tmp for linux)
log_dirs = [".", tempfile.gettempdir()]
+ log_file = None
if "REPO_DIR" in os.environ:
log_dirs.insert(0, os.environ["REPO_DIR"])
for d in log_dirs:
log_path = os.path.join(d, ".jupyter-server-log.txt")
try:
log_file = open(log_path, "ab")
- except PermissionError:
+ except Exception:
continue
else:
# success
break
+ # raise Exception if log_file could not be set
+ if log_file is None:
+ raise Exception("Could not open '.jupyter-server-log.txt' log file " )
# build the command
# like `exec "$@"`
