I was simply modifying some of the sample code. Strangely, there was no error for the 32nd line (making a copy of the sphere) and it was executed, but it threw an error for the 33rd line even though both involves modifying and some sort of transaction with the document.
Hi Everyone,
I have a problem with GHPython and the Revit API.
I copy the sample7 in a GHPython script, I let it run and it works the first time, then if I delete the sphere in Revit 2020 and try to run the script a second time GH throws me this error:
“Runtime error (InvalidOperationException): Starting a transaction from an external application running outside of API context is not allowed.”
The problem is that if you have the GHPython “IDE” open and click on the Revit workspace, GH will be closed, but you will still see the GHPython “IDE” and can go on working on the script.
In this situation if you click on test, Revit consider it as an external call to the API and throws an error message.