The following script suggested by pyRevit Document works:
from pyrevit import script
output = script.get_output()
output.print_md('# My Title')
output.print_md('**Bold message**')
But gives the following error if starting with “#! python3”:
**CPython Traceback:**
cannot import name 'Callable' from 'collections' (C:\Program Files\pyRevit-Master\bin\cengines\CPY3123\python312.zip\collections\__init__.pyc)
pyRevitLabs.PythonNet
File "C:\Program Files\pyRevit-Master\pyrevitlib\pyrevit\coreutils\pyutils.py", line 13, in <module>
from collections import OrderedDict, Callable #pylint: disable=E0611
What should be the equivalent scripts for CPython?
I used pyRevit 5.0.0 with Revit 2024. I have now uninstalled 5.0.0, installed 5.0.1, updated pyRevit, closed and opened Revit, updated pyRevit again, and run the above script beginning with #! python3 or #! cpython3. Still getting the following error:
CPython Traceback:
cannot import name ‘Callable’ from ‘collections’ (C:\Program Files\pyRevit-Master\bin\cengines\CPY3123\python312.zip\collections_init_.pyc)
pyRevitLabs.PythonNet
File “C:\Program Files\pyRevit-Master\pyrevitlib\pyrevit\coreutils\pyutils.py”, line 13, in
from collections import OrderedDict, Callable #pylint: disable=E0611
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
from collections import OrderedDict
from collections.abc import Callable
IronPython 3.4
from collections import OrderedDict, Callable
Looks like this should be flagged over at GitHub for follow-up. (Done.)
pyRevit is importing that under IronPython and all is fine.
If you try and load pyutils.py manually with cpython, you get the error.