import pathlib script_file = pathlib.Path(__file__) script_dir = script_file.parent project_root = script_dir.parent dotenv_path = project_root / '.env' with open(dotenv_path, 'w') as f: f.write(f"# This file is automatically generated by the setup script {script_dir.name}/{script_file.name}. Do not edit it manually.\n") f.write(f"PYTHONPATH={project_root};{project_root / 'surveyladder'}\n")