create_config.py 769 B

1234567891011121314151617181920212223242526
  1. import sys
  2. from pathlib import Path
  3. # Add the utils directory to the Python path
  4. utils_path = Path(__file__).parent / 'utils'
  5. sys.path.append(str(utils_path))
  6. from config_utils import load_config, get_config_path
  7. def main():
  8. """
  9. Ensures the configuration file exists by calling the load_config utility.
  10. """
  11. print("Checking for configuration file...")
  12. # load_config() will automatically create the file if it doesn't exist.
  13. config = load_config()
  14. config_path = get_config_path()
  15. if config:
  16. print(f"Successfully created or updated config file at: {config_path}")
  17. else:
  18. print(f"Error: Could not create or load the configuration file.", file=sys.stderr)
  19. sys.exit(1)
  20. if __name__ == "__main__":
  21. main()