<div dir="ltr"><div>Hello community, please help if you can! </div><div> </div><div>I'm adapting a script that I found online <a href="https://gist.githubusercontent.com/thengineer/7157510/raw/05dcde3bf47a8db04af98462e23103296996857b/autocadblockreader.py" target="_blank">here</a>.</div><div> </div><div>I'm trying to change it so that it can open a document, and then change it. </div><div> </div><div>Here's what I have:</div><div> </div><div>import win32com.client<br>acad = win32com.client.DispatchEx("<wbr>AutoCAD.Application")<br>acad.Visible = True</div><div> </div><div>doc = acad.Documents.Open("<em>path</em>")   # Document object</div><div><br># iterate trough all objects (entities) in the currently opened drawing<br># and if its a BlockReference, display its attributes and some other things.<br>for entity in acad.Database.Blocks:<br>    name = entity.EntityName<br>     if name == 'AcDbBlockReference':<br>         HasAttributes = entity.HasAttributes<br>         if HasAttributes:<br>             for attrib in entity.GetAttributes():<br>             string = str(attrib.TextString)<br>             print(entity.Name)<br>             print(entity.Layer)<br>             print(entity.<wbr>ObjectID)<br>             print("  {}: {}".format(attrib.TagString, attrib.TextString))</div><div>             #update text<br>             attrib.TextString = "success!"<br>             attrib.Update()</div><div> </div><div> </div><div>I'm getting the error attached.</div><div> </div><div>Does anybody know where I'm going wrong?</div><div> </div><div>Thanks,</div><div> </div><div>Josh</div><div><span style="font-family:"calibri","sans-serif";font-size:11pt"><span style="font-family:"calibri","sans-serif";font-size:11pt"><span style="font-family:"calibri","sans-serif";font-size:11pt"><span></span></span></span></span></div></div>