Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PythonNet3 : with statement ( IDisposable .NET objects) create attribute error #15814

Open
Cyril-Pop opened this issue Feb 6, 2025 · 2 comments

Comments

@Cyril-Pop
Copy link

Dynamo Version

Dynamo 3.3 and more

Host

Revit or Civil3D

Operating System

Windows 11

What did you do?

Try to use with statement on Disposable .Net Object

import clr
import sys
import re
import System

#import Revit API
clr.AddReference('RevitAPI')
import Autodesk
from Autodesk.Revit.DB import *
import Autodesk.Revit.DB as DB

#import transactionManager and DocumentManager (RevitServices is specific to Dynamo)
clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

doc = DocumentManager.Instance.CurrentDBDocument

with Transaction(doc, 'CommandName') as t:
    print(f"{t=}")
    print(t.GetType().ToString())
    t.Start()
    # do stuff
    t.Commit()

What did you expect to see?

no error

What did you see instead?

Attribute Error

Image

What packages or external references (if any) were used?

No response

Stack Trace

No response

Details

FYI @twastvedt

Copy link

github-actions bot commented Feb 6, 2025

Thank you for submitting the issue to us. We are sorry to see you get stuck with your workflow. While waiting for our team member to respond, please feel free to browse our forum at https://forum.dynamobim.com/ for more Dynamo related information.

@johnpierson
Copy link
Member

Tracked internally here DYN-8274

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Todo
Development

No branches or pull requests

2 participants