diff --git a/dvc/command/version.py b/dvc/command/version.py index 91fa69fbdf..9aff698cc0 100644 --- a/dvc/command/version.py +++ b/dvc/command/version.py @@ -45,10 +45,16 @@ def run(self): package=PKG, ) + is_repo = False + try: repo = Repo() root_directory = repo.root_dir + is_repo = True + except NotDvcRepoError: + root_directory = os.getcwd() + if is_repo: # cache_dir might not exist yet (e.g. after `dvc init`), and we # can't auto-create it, as it might cause issues if the user # later decides to enable shared cache mode with @@ -70,8 +76,6 @@ def run(self): info += ( "Filesystem type (cache directory): {fs_cache}\n" ).format(fs_cache=self.get_fs_type(repo.cache.local.cache_dir)) - except NotDvcRepoError: - root_directory = os.getcwd() if psutil: info += ("Filesystem type (workspace): {fs_root}").format(