Skip to content

Commit

Permalink
Fixed permission issue on NT systems when trying to overwrite existin…
Browse files Browse the repository at this point in the history
…g directory
  • Loading branch information
Andrew Mickael committed Apr 5, 2020
1 parent da6a414 commit 335ab9d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion create_flask_service/Service.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@ def __init__(self, service_name: str, root_dir: str):
try:
shutil.rmtree(self.cwd)
except (PermissionError, WindowsError):
os.chmod(self.cwd, stat.S_IWUSR)
for root, dirs, files in os.walk(self.cwd):
for directory in dirs:
os.chmod(os.path.join(root, directory), stat.S_IWUSR)
for file in files:
os.chmod(os.path.join(root, file), stat.S_IWUSR)
shutil.rmtree(self.cwd)
else:
print("Stopping")
Expand Down
2 changes: 1 addition & 1 deletion create_flask_service/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@


__author__ = "Andrew Mickael"
__version__ = "0.1.2"
__version__ = "0.1.3"
__description__ = "Create a Flask microservice with a few keystrokes"


Expand Down

0 comments on commit 335ab9d

Please sign in to comment.