Issue with CPython

Hello,

I made a script with Python to create a point in DYNAMO. It worked fine with CPython on Revit 2022, but I get an error message when I use Revit 2023.1 or Revit 2024.1.

Everything’s is fine if I run it with IronPython in revit 2023.1, but it doesn’t work on CPython anymore.

Do you have any idea about the cause of the problem ?

image

image

I don’t get that error in Revit 23.1

Have you tried writing it from scratch instead of upgrading maybe?

@Alien ,

in Revit 2024.2 it does not work :frowning:


KR
Andreas

When you type the word, “Point” and then put a .
Do you get examples of what you can use?

image

yes i get @Alien


KR
Andreas

If I write the code from scratch, it works on Revit 2023.1, but not for Revit 2024.2.


I updated Revit 2024 two weeks ago. I’m wondering if I should clean up the directories for the DYNAMO versions.
image

1 Like

Hello all - Thanks for putting this thread out there! @tiberiu.pinzariu is going to take a look at this on our end and see what is happening :pray:

The behavior is not intended as we intend to support existing cases - so feels like a bug somewhere.

2 Likes

Hi @tidiane.dia_MaM

I have not been able to reproduce this so to figure out more about what could be causing this I would like to get more info.

  1. Please confirm the Dynamo version used by Revit 2024; should be 2.19.3.xxx
    Assuming the Dynamo version used by Revit2024 is 2.19.3.6394 please download dynamo locally from here
    https://dyn-builds-data.s3-us-west-2.amazonaws.com/DynamoCoreRuntime_2.19.3.6394_20231002T0726.zip
    Now let’s try to reproduce the issue with dynamo sandbox. This should tell us if the issue is caused by Dynamo running in the Revit context. Also try to run the Point API call and then a something simpler like

    import sys
    OUT = sys.path
    
  2. Now to get more info on what is happening on the Revit side:

  • Try to run this in Dynmo Revit 2024 and share it.
    import sys OUT = sys.path

  • List any custom pacakges loaded by python:
    Dynamo 2.19.3 should be using python-3.9.12-embed-amd64
    go to `%localappdata%/python-3.9.12-embed-amd64 and list out the packages under Lib\site-packages (site-packages might be missing if you did not install anything manually)

    As a side note: Dynamo uses an Embeddable Package of Python. This allows Dynamo to have its own Python home, without requiring users to install Python or adding it to the PATH. More info here

  • List the dynamo packages and their versions(Open up Preferences-> Pacakge Manager -> Installed pacakges and take a snapshot of the installed packages list)

  • List all installed revit addins

2 Likes

@tiberiu.pinzariu ,

i made a video a bug at work → live! :wink:
2024-01-22_12h39_02
KR
Andreas

2 Likes

Hello all,
any progress on this topic please? I am using many scripts with Cpython3 and none of them works right now on Revit 2024.2. It is not possible for me to downgrade all scripts to IronPython2…

Thanks
Lucie

1 Like

Hi @Lucy_Lastparametrics - In the interim you can try the IronPython3 package. We have not yet started upgrading PythonNET, but it’s on our to-do list.

1 Like

@solamour ,

Do have any content about this new .NET enviroment, because i heard it will also impact pyRevit. Is there anything to read, for better understanding.

KR

Andreas

Hi @tiberiu.pinzariu ,

  1. Yes, the Dynamo version is 2.19.3.6394.
    I still have the issue with Point.ByCoordinates() when using DYNAMO with Revit. But it works with DynamoSandbox.

PythonNET isn’t the new .NET upgrade for Dynamo, but rather an entirely different project that “bridges” the worlds of .NET (Dynamo) and Python together and allows them to talk to each other. You can read more about it here.

This project is open source so we are reliant on them putting in fixes to that, or doing fixes ourselves. So far in Dynamo we opted for the latter, which is fixing things ourselves, but the problem with that approach is that we get more and more out of sync with the PythonNET project main branch and at some point that overhead becomes too high. So, we want to upgrade to their main branch as, given time has passed now, they have caught up with some of the fixes we put into Dynamo. Other fixes salient only to Dynamo users will persist on our side.

3 Likes

Note that ‘none’ indicates another issue beyond the CPython. There are a LOT of breaking changes in the Revit API between the last supported version of Iron Python 2 and 2024.2, so best to verify those are resolved as most Python should work fine, or can be made to work with minimal modifications (excepting the iInterface issues).