Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PYTHON_ARGCOMPLETE_OK not working when calling subprocess #520

Open
64rl0 opened this issue Jan 22, 2025 · 0 comments
Open

PYTHON_ARGCOMPLETE_OK not working when calling subprocess #520

64rl0 opened this issue Jan 22, 2025 · 0 comments

Comments

@64rl0
Copy link

64rl0 commented Jan 22, 2025

I have an entry point in my project_root/scripts however what that script is doing is running a subprocess to run the script with the correct python interpreter and its dependencies like:

project_root/scripts/my-cli.py

def main():
    # Determine the base path at runtime
    this_path = os.path.dirname(os.path.abspath(__file__))
    root_path = os.path.join(this_path, '..')

    # Locate the Python interpreter in the bundled venv
    venv_python = os.path.join(root_path, 'build_venv/bin/python3')

    # Path to main script
    main_script = os.path.join(root_path, 'entrypoint.py')

    # Check if the bundled interpreter exists
    if not os.path.exists(venv_python):
        print("Python interpreter not found. Please create it.")
        sys.exit(1)

    # Run the main script with the bundled interpreter
    command = [venv_python, main_script] + sys.argv[1:]
    result = subprocess.run(command)

    return result.returncode

if I place the # PYTHON_ARGCOMPLETE_OK in the project_root/scripts/my-cli.py then the completion is not working

however if i place it on the entrypoint.py that is called by the subprocess here above then it works perfectly

obviously I cannot call entrypoint.py directly from my zsh because I don't always have the correct venv activated.

Is there a work around for this to work?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant