diff --git a/dvc/command/version.py b/dvc/command/version.py index 91fa69fbdf..d03cf9d1ce 100644 --- a/dvc/command/version.py +++ b/dvc/command/version.py @@ -44,11 +44,17 @@ def run(self): binary=binary, 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,9 +76,7 @@ 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( fs_root=self.get_fs_type(os.path.abspath(root_directory))