Skip to content

Issue with run command (python script) #4

Description

@tushartushar

The run command with python option have some issue (or, I didn't use it properly). I tried in the following two ways.

$Aap yahan hain: ~/workspace ⭐ codegreen run -- python agents/temp.py 
Energy backend: NEMB (native energy measurement)
Warmup 1/1
Unexpected error: [Errno 2] No such file or directory: 'python'
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/codegreen/cli/cli.py", line 3376, in main_cli
    app()
    ~~~^^
  File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/typer/main.py", line 1152, in __call__
    raise e
  File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/typer/main.py", line 1135, in __call__
    return get_command(self)(*args, **kwargs)
           ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/click/core.py", line 1485, in __call__
    return self.main(*args, **kwargs)
           ~~~~~~~~~^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/typer/core.py", line 795, in main
    return _main(
        self,
    ...<6 lines>...
        **extra,
    )
  File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/typer/core.py", line 188, in _main
    rv = self.invoke(ctx)
  File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/click/core.py", line 1873, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/click/core.py", line 1269, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/click/core.py", line 824, in invoke
    return callback(*args, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/typer/main.py", line 1514, in wrapper
    return callback(**use_params)
  File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/codegreen/cli/cli.py", line 2374, in run_command
    subprocess.run(command, capture_output=True, timeout=300)
    ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/subprocess.py", line 554, in run
    with Popen(*popenargs, **kwargs) as process:
         ~~~~~^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/subprocess.py", line 1039, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
    ~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                        pass_fds, cwd, env,
                        ^^^^^^^^^^^^^^^^^^^
    ...<5 lines>...
                        gid, gids, uid, umask,
                        ^^^^^^^^^^^^^^^^^^^^^^
                        start_new_session, process_group)
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/subprocess.py", line 1972, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'python'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.13/bin/codegreen", line 7, in <module>
    sys.exit(main_cli_wrapper())
             ~~~~~~~~~~~~~~~~^^
  File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/codegreen/cli/entrypoint.py", line 27, in main_cli_wrapper
    return main_cli()
  File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/codegreen/cli/cli.py", line 3385, in main_cli
    raise typer.Exit(1)
click.exceptions.Exit: 1
$Aap yahan hain: ~/workspace ⭐ codegreen run --python agents/temp.py 
Usage: codegreen run [OPTIONS] COMMAND...
Try 'codegreen run -h' for help.
╭─ Error ──────────────────────────────────────────────────────────────────────╮
│ No such option: --python                                                     │
╰──────────────────────────────────────────────────────────────────────────────╯
$Aap yahan hain: ~/workspace ⭐ 

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingdocumentationImprovements or additions to documentation

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions