Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix IsADirectoryError in main_no_modal.py #80

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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