Cpython Runtime False - PyRevit 5.01 + Revit 2024

We are experiencing issues in trying to get Cpython to run within the pyRevit tools within Revit 2024.
Our project models are Revit 2024 so we need to stay on this version

We installed pyRevit version 5.01 and managed to customise our ribbon however, when we try to run Cpython by including #!python3 at the start of the script, pyRevit insists on running Iron python

We set up the following brief script to test the sys version

#!Python3
import sys
print(“Python Executable:”, sys.executable)
print(“Python Version:”, sys.version)
print(“Sys Path:”, sys.path)

running this through a button on the ribbon confirms that the python version is Ironpython 2.7

if we run the command
pyrevit clones engines master

this confirms amongst other things that the Cpython runtime is false

CPY3123 (netfx) | Kernel: CPython | Version: 3123 | Runtime: False | Path: “C:\Program Files\pyRevit-Master\bin\cengines\CPY3123\python312.dll” | Desc: “CPython Engine”

we have tried multiple different ways to get Runtime: True but nothing seems to work.

Is there a known issue with the pyRevit_5.0.1.25051_admin_signed (1).exe installation whereby Cpython will not run in Revit 2024.

We have not as yet tested this in Revit 2025.

OK I think I may have taken a step forward with this.

I uninstalled PyRevit and Python3.12.3 and deleted all associated installation directories to avoid confusion with a subsequent reinstall.

I then did a full clean reinstall of PyRevit as Administrator and then a full clean install of Python3.12.3 again as Administrator. These installs were essentially accepting the defaults.

PyRevit re-appeared in Revit and using the settings a added back our company ribbon.

I noticed in the settings for pyRevit that to invoke Cpython, it is necessary to include the following as the first line

#! python3

I previously had
#!Python3
so it appears that the space character and possibly the lower case p matter to invoke Cpython.

It is not clear if it is the full clean reinstall or the starting line of the script or both which has allowed Cpython to be run but it is now running in Revit 2024.

Starting lline was indeed wrong.

The problem was the uppercase P, if I remember correctly pyrevit checks for just the python3 word in the first line (the ! is a mock of the shebangs used in *NIX scripts)