Skip to content

Commit

Permalink
Fix IsADirectoryError in main_no_modal.py
Browse files Browse the repository at this point in the history
  • Loading branch information
MaskyS authored Jun 6, 2023
1 parent e0a11ad commit 8d50a73
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion main_no_modal.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,14 @@ def write_file(filename, filecode, directory):
print("\033[94m" + filename + "\033[0m")
print(filecode)

file_path = directory + "/" + filename
file_path = os.path.join(directory, filename)
dir = os.path.dirname(file_path)

# Check if the filename is actually a directory
if os.path.isdir(file_path):
print(f"Error: {filename} is a directory, not a file.")
return

os.makedirs(dir, exist_ok=True)

# Open the file in write mode
Expand Down

0 comments on commit 8d50a73

Please sign in to comment.