diff --git a/metagpt/roles/engineer.py b/metagpt/roles/engineer.py index aced4fca3..84fb3fa6a 100644 --- a/metagpt/roles/engineer.py +++ b/metagpt/roles/engineer.py @@ -436,8 +436,6 @@ class Engineer(Role): workdir = self.src_workspace / filename.parent if not workdir.exists(): workdir = self.project_repo.workdir / filename.parent - if not workdir.exists(): - return await init_python_folder(workdir) async def _is_fixbug(self) -> bool: diff --git a/metagpt/utils/common.py b/metagpt/utils/common.py index fd7fdcb7a..db1831aad 100644 --- a/metagpt/utils/common.py +++ b/metagpt/utils/common.py @@ -894,6 +894,11 @@ def get_project_srcs_path(workdir: str | Path) -> Path: async def init_python_folder(workdir: str | Path): + if not workdir: + return + workdir = Path(workdir) + if not workdir.exists(): + return init_filename = Path(workdir) / "__init__.py" if init_filename.exists(): return