[Python] VSCode or Pylance creating files when I edit code

Discussão em 'Python' iniciado por Stack, Março 3, 2025.

  1. Stack

    Stack Membro Participativo

    I'm encountering some very bizarre behaviour that I've tried to simplify as much as possible. I have a project laid out similar to below. Whenever I edit any file in the project, the file /localdisk/my-project/log.log get created automatically. If I delete the file and re-edit the code the file is created again. This happened within a few seconds. This only seems to happen when another module imports the utils file, and not all modules that import utils cause this behaviour. For example a file named foo_test.py would cause it, but a file with the same contents names foo.py would not.

    # utils.py

    import logging
    DEFAULT_LOG_FILE = '/localdisk/my-project/log.log'
    file_handler = logging.FileHandler(DEFAULT_LOG_FILE)


    .

    # foo_test.py

    import utils


    I'm using VSCode 1.97.2, Pylance 2025.2.1, Python 3.12. I'm absolutely stumped by what's going on. I don't know if there's some setting I've accidentally enabled or some optimization behind the scenes trying to create possible files ahead of time. Any ideas would be appreciated.

    Continue reading...

Compartilhe esta Página