Skip to content

Python Script: Execute Another Python Script (CURD) #36

@bhargavnova

Description

@bhargavnova

Objective

Develop a Python script that allows users to perform basic CURD (Create, Read, Update, Delete) operations on entries representing Python scripts. This tool will enable users to manage a collection of Python scripts, execute them, and perform operations like adding new scripts, updating existing ones, reading script details, and deleting scripts.

Features

  • Add Script Entry:

    • Implement functionality to add a new entry representing a Python script with a specified name and path.
  • List Existing Scripts:

    • Allow users to view a list of currently added script entries.
  • Execute Script:

    • Provide the ability to execute a selected Python script from the list.
  • Update Script Details:

    • Allow users to modify the name or path of an existing script entry.
  • Delete Script Entry:

    • Enable users to remove a specific script entry based on its ID or name.

Example Usage

import script_manager

# Add a new script entry
script_manager.add_script('Script Name', '/path/to/script.py')

# List existing scripts
script_manager.list_scripts()

# Execute a script
script_manager.execute_script(1)

# Update script details
script_manager.update_script(1, new_name='New Script Name', new_path='/new/path/to/script.py')

# Delete a script entry
script_manager.delete_script(2)

Difficulty: Beginner/Intermediate

Tags: Python, Script Management, File Execution, CURD Operations

Additional Information

  • Ensure that the script provides informative error messages in case of invalid inputs or other issues during script execution or management.

Contribution Guidelines

The updated guidelines can be found here.

Note:

  • folder_name: py_script_manager
  • script_name: py_script_manager

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions