Skip to content

Commit

Permalink
fix for issue #354 (#356)
Browse files Browse the repository at this point in the history
* fix for issue #354

* catch OSError instead of FileExistsError, since FileExistsError is not available in python 2.7
  • Loading branch information
tedchamb authored Aug 13, 2020
1 parent 9933a9d commit ccb682a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion azure-devops/azure/devops/_file_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down

0 comments on commit ccb682a

Please sign in to comment.