puppetlabs/bolt

Error 'File extension .py is not enabled' when running tasks on Windows 10 localhost

Closed this issue · 3 comments

I'm having a hard time running tasks on localhost. Both directly and/or running within a plan.
I've tried adding the .py extension to inventory.yaml at various levels, with no success.

config:
  winrm:
    extensions:
      - .py

Example:

PS C:\Users\username\puppet\bolt> bolt task run myproject::generate_environment_variables --targets localhost
Started on localhost...
Failed on localhost:
  File extension .py is not enabled, to run it please add to 'winrm: extensions'
Failed on 1 target: localhost
Ran on 1 target in 0.78 sec

Ah, so localhost will run with the local transport by default, not winrm. As a workaround you can add interpreters key to the local transport:

config:
  local:
    interpreters:
      ".py": "C:/Path/To/Python"

But we need to add an extensions key for the local transport. I'd consider that a bug. Thanks for raising this!

Alternatively, you can also connect to localhost over WinRM by running --targets winrm://localhost or --targets://127.0.0.1.

Confirmed working fix:

# inventory.yaml
config:
  local:
    interpreters:
      ".py": "C:/Python39/python.exe"

Thanks!

Bah.. Closed by accident. Not sure if you want this issue open or not :)