Fix error message when dry-run without wandb init.
@@ -125,7 +125,8 @@ def termlog(string='', newline=True):
# The current run (a Run object)
run = None
-if __stage_dir__ and MODE != 'cli':
+if MODE != 'cli':
+ if __stage_dir__:
_run_id = os.getenv('WANDB_RUN_ID')
if _run_id is None:
_run_id = wandb_run.generate_id()
@@ -144,6 +145,12 @@ if __stage_dir__ and MODE != 'cli':
persist_callback=persist_config_callback)
run = wandb_run.Run(_run_id, _run_dir, _config)
_do_sync(run.dir)
+ else:
+ # The WANDB_DEBUG check ensures tests still work.
+ if not os.getenv('WANDB_DEBUG'):
+ print('wandb imported but directory not initialized.\n'
+ 'Please run "wandb init" to get started')
+ sys.exit(1)
if __stage_dir__ is not None:
log_fname = __stage_dir__ + 'debug.log'
else:
