Closed imigas434 closed 1 year ago
more suitable for the forum IMHO
see https://danimosite.wordpress.com/2017/05/11/intro-to-transactions/
TransactionManager.Instance.EnsureInTransaction(doc)
try:
#Make some changes to the Revit Document...
except Exception as e:
print(e)
#Maybe Throw an Error Message...
TransactionManager.Instance.TransactionTaskDone()
Hello, I create new scripts and custom panels/buttons using pyRevit. One of my scripts must simply update parameter of a single room. It seems there is an error, but because it is in Transaction part, I cannot see the error in the output terminal. Revit immediately shuts down pyRevit window and throws an alert that it will rollback transaction because it was not closed.
My question is: how can I properly debug my script in this situation? Can I do anything to stop Revit from throwing this alert?
Following code is my test script. (What is even funnier, if I used
with revit.Transaction(sth)
from pyrevit module instead ofEnsureInTransaction
, the script would not throw any error or alert. But I cannot use this method as importingrevit
frompyrevit
is impossible while using CPython 3)