diff --git a/azure-devops/azure/devops/_file_cache.py b/azure-devops/azure/devops/_file_cache.py index 55da484c..2415ebab 100644 --- a/azure-devops/azure/devops/_file_cache.py +++ b/azure-devops/azure/devops/_file_cache.py @@ -114,7 +114,13 @@ def get_cache_dir(): azure_devops_cache_dir = os.getenv('AZURE_DEVOPS_CACHE_DIR', None)\ or os.path.expanduser(os.path.join('~', '.azure-devops', 'python-sdk', 'cache')) if not os.path.exists(azure_devops_cache_dir): - os.makedirs(azure_devops_cache_dir) + try: + os.makedirs(azure_devops_cache_dir) + except OSError: + # https://github.com/microsoft/azure-devops-python-api/issues/354 + # FileExistsError is not available in python 2.7 + if not os.path.exists(azure_devops_cache_dir): + raise return azure_devops_cache_dir