Skip to content

Reload extra files in the current directory with inotify #3377

Closed

Description

@davegaeddert

It seems that adding an extra watch file in the current directory, like .env, will cause inotify to crash because the os.path.dirname(".env") == "". Using ./.env works though (dirname is then .) or an absolute path works too.

def add_extra_file(self, filename):
dirname = os.path.dirname(filename)
if dirname in self._dirs:
return
self._watcher.add_watch(dirname, mask=self.event_mask)
self._dirs.add(dirname)

Curious what you think? If this is something that should be allowed, then I wonder if you could just do something like this to protect against it:

if not dirname:
    dirname = "."

Thanks!

Activity

  1. pajod commented on Apr 8, 2025

    @pajod
    Contributor

    While Gunicorn should definitely not crash with an ugly message.. passing relative paths should probably be discouraged anyway, given the non-obvious (and as of now, undocumented) interaction with the --chdir setting.

  2. added a commit that references this issue on Aug 4, 2026
    7823ebf
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