Skip to content

error when writing inside folders #26

Open

Description

@LukasMeine

I'm getting this all the time. With and Without Modal

IsADirectoryError: [Errno 21] Is a directory: 'generated/src/'

It seems that smol is trying to write directly to the folder, instead to the appropriate file.

Activity

  1. changed the title [-]error when writing to folders[/-] [+]error when writing inside folders[/+] on May 19, 2023
  2. swyxio commented on May 22, 2023

    @swyxio
    Contributor

    hi! hmm. i think i understand - will fix this in the coming version of smol (i am working on #12 )

  3. LukasMeine commented on May 22, 2023

    @LukasMeine
    ContributorAuthor

    nice! Thanks for the amazing work, your repo is great!

  4. jonnyhoff commented on May 31, 2023

    @jonnyhoff

    Got the same error:

    IsADirectoryError: [Errno 21] Is a directory: 'generated/app/'
    
  5. jonnyhoff commented on May 31, 2023

    @jonnyhoff

    The fix

    In the write_file function

    Before:

          with open(file_path, "w") as file:
              # Write content to the file
              file.write(filecode)

    After:

        if not file_path.endswith("/"):
            with open(file_path, "w") as file:
                # Write content to the file
                file.write(filecode)
  6. added a commit that references this issue on Jun 6, 2023
    8d50a73
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions