# Erorr When Run Python Script

**URL:** <https://forum.dynamobim.com/t/erorr-when-run-python-script/77768>\
**Category:** Civil 3D\
**Tags:** cpython3\
**Created:** [June 18, 2022, 7:16am UTC](https://forum.dynamobim.com/t/erorr-when-run-python-script/77768 "2022-06-18T07:16:06Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![c.poupin](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/c.poupin/32/89152_2.png) [@c.poupin](https://forum.dynamobim.com/u/c.poupin)\
**Post date:** [June 18, 2022, 2:04pm UTC](https://forum.dynamobim.com/t/erorr-when-run-python-script/77768/4 "2022-06-18T14:04:24Z")

</div>

hello @khang.civil.2000 see this topic

> [@"TypeError" When Trying to Get Block Table Record of Model Space](https://forum.dynamobim.com/t/typeerror-when-trying-to-get-block-table-record-of-model-space/77729):
>
> Has anyone seen this error before? All I did was add the following code to a generic python code block: bt = t.GetObject(db.BlockTableId, OpenMode.ForWrite) btr = t.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForWrite) And I am getting this odd “Type Error: No Method matches given arguments for OnExit: (\<class ‘Autodesk.AutoCAD.ApplicationServices.DocumentLock’\>, \<class ‘type’\>” I can use: list(bt) to see a list of blockIDs but I can’t seem to do much with them. I also get an error …

_the traceback is really blurry.  
the report of the `traceback.tb_lineno` seem missing in implementation of context manager_

---

_[View the full topic](https://forum.dynamobim.com/t/erorr-when-run-python-script/77768)._
