Skip to content

Commit

Permalink
Adding better error message regarding web root folder access, thanks …
Browse files Browse the repository at this point in the history
…to msteijaert
  • Loading branch information
swansonk14 committed Sep 22, 2020
1 parent 0ff6fd4 commit fc35354
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions chemprop/web/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ def set_root_folder(app: Flask, root_folder: str = None, create_folders: bool =

# Create folders
if create_folders:
if not os.access(os.path.dirname(app.config['ROOT_FOLDER']), os.W_OK):
raise ValueError(f'You do not have write permissions on the root_folder: {app.config["ROOT_FOLDER"]}\n'
f'Please specify a different root_folder while starting the web app.')

for folder_name in ['ROOT_FOLDER', 'DATA_FOLDER', 'CHECKPOINT_FOLDER', 'TEMP_FOLDER']:
os.makedirs(app.config[folder_name], exist_ok=True)

Expand Down

0 comments on commit fc35354

Please sign in to comment.