<#474 AttributeError: 'SimplePolygon' object has n...
# ihp-sg13g2
g
#474 AttributeError: 'SimplePolygon' object has no attribute 'to_simple_polygon' when running pytest_cell.py Issue created by threaddy When running klayout -zz -r pycell_test.py, as indicated in pycell_test.py, several errors happen:
Copy code
klayout -zz -r pycell_test.py
Import is done
Module klayout_pyxs.pyxs_lib.py reloaded
ERROR: /root/.klayout/salt/klayout_pyxs/python/klayout_pyxs/pyxs_lib.py:958: NameError: name 'Application' is not defined
 /root/.klayout/salt/klayout_pyxs/python/klayout_pyxs/pyxs_lib.py:958
 /root/.klayout/salt/klayout_pyxs/pymacros/pyxs.lym:19 (class NameError)
ERROR: /root/.klayout/salt/klayout_pyxs/python/klayout_pyxs/pyxs_lib.py:958: NameError: name 'Application' is not defined
 /root/.klayout/salt/klayout_pyxs/python/klayout_pyxs/pyxs_lib.py:958
 /root/.klayout/salt/klayout_pyxs/pymacros/pyxs_dev.lym:17 (class NameError)
ERROR: /root/.klayout/salt/klive/klayout/pymacros/klive.lym:8: AttributeError: 'NoneType' object has no attribute 'menu'
 /root/.klayout/salt/klive/klayout/pymacros/klive.lym:8 (class AttributeError)
Warning: Box.destroy: already destroyed!
Warning: Box.destroy: already destroyed!
Warning: Box.destroy: already destroyed!
Warning: Box.destroy: already destroyed!
Warning: Box.destroy: already destroyed!
Warning: Box.destroy: already destroyed!
Warning: Box.destroy: already destroyed!
Warning: Box.destroy: already destroyed!
Warning: Box.destroy: already destroyed!
Warning: Box.destroy: already destroyed!
Warning: Box.destroy: already destroyed!
Warning: Box.destroy: already destroyed!
Warning: Box.destroy: already destroyed!
Warning: Box.destroy: already destroyed!
Warning: Box.destroy: already destroyed!
Warning: Box.destroy: already destroyed!
Warning: Box.destroy: already destroyed!
Warning: Box.destroy: already destroyed!
ERROR: Traceback (most recent call last):
  File "/opt/pdk/IHP-Open-PDK/ihp-sg13g2/libs.tech/klayout/tech/pymacros/../../python/pycell4klayout-api/source/python/cni/dlo.py", line 225, in produce
    self._impl.genLayout()
  File "/opt/pdk/IHP-Open-PDK/ihp-sg13g2/libs.tech/klayout/tech/pymacros/../../python/sg13g2_pycell_lib/ihp/sealring_code.py", line 152, in genLayout
    ihpCopyFig(groupId, Point(l, w), 'R180')
  File "/opt/pdk/IHP-Open-PDK/ihp-sg13g2/libs.tech/klayout/tech/pymacros/../../python/sg13g2_pycell_lib/ihp/geometry.py", line 1186, in ihpCopyFig
    cons(newList, dbCopyShape(item, pnt, rot))
  File "/opt/pdk/IHP-Open-PDK/ihp-sg13g2/libs.tech/klayout/tech/pymacros/../../python/sg13g2_pycell_lib/ihp/geometry.py", line 187, in dbCopyShape
    dbMoveFig(copyId, pnt, rot)
  File "/opt/pdk/IHP-Open-PDK/ihp-sg13g2/libs.tech/klayout/tech/pymacros/../../python/sg13g2_pycell_lib/ihp/geometry.py", line 199, in dbMoveFig
    fig.moveBy(pnt.x, pnt.y)
  File "/opt/pdk/IHP-Open-PDK/ihp-sg13g2/libs.tech/klayout/tech/pymacros/../../python/pycell4klayout-api/source/python/cni/polygon.py", line 75, in moveBy
    dataBaseUnits).to_simple_polygon().to_dtype(Tech.get(Tech.techInUse).dataBaseUnits)
AttributeError: 'SimplePolygon' object has no attribute 'to_simple_polygon'
ERROR: Traceback (most recent call last):
  File "/opt/pdk/IHP-Open-PDK/ihp-sg13g2/libs.tech/klayout/tech/pymacros/../../python/pycell4klayout-api/source/python/cni/dlo.py", line 225, in produce
    self._impl.genLayout()
  File "/opt/pdk/IHP-Open-PDK/ihp-sg13g2/libs.tech/klayout/tech/pymacros/../../python/sg13g2_pycell_lib/ihp/npn13G2L_code.py", line 198, in genLayout
    groupId = ihpCopyFig(groupId, Point(2.8, 0), 'R0')
  File "/opt/pdk/IHP-Open-PDK/ihp-sg13g2/libs.tech/klayout/tech/pymacros/../../python/sg13g2_pycell_lib/ihp/geometry.py", line 1186, in ihpCopyFig
    cons(newList, dbCopyShape(item, pnt, rot))
  File "/opt/pdk/IHP-Open-PDK/ihp-sg13g2/libs.tech/klayout/tech/pymacros/../../python/sg13g2_pycell_lib/ihp/geometry.py", line 187, in dbCopyShape
    dbMoveFig(copyId, pnt, rot)
  File "/opt/pdk/IHP-Open-PDK/ihp-sg13g2/libs.tech/klayout/tech/pymacros/../../python/sg13g2_pycell_lib/ihp/geometry.py", line 199, in dbMoveFig
    fig.moveBy(pnt.x, pnt.y)
  File "/opt/pdk/IHP-Open-PDK/ihp-sg13g2/libs.tech/klayout/tech/pymacros/../../python/pycell4klayout-api/source/python/cni/polygon.py", line 75, in moveBy
    dataBaseUnits).to_simple_polygon().to_dtype(Tech.get(Tech.techInUse).dataBaseUnits)
AttributeError: 'SimplePolygon' object has no attribute 'to_simple_polygon'
ERROR: Traceback (most recent call last):
  File "/opt/pdk/IHP-Open-PDK/ihp-sg13g2/libs.tech/klayout/tech/pymacros/../../python/pycell4klayout-api/source/python/cni/dlo.py", line 225, in produce
    self._impl.genLayout()
  File "/opt/pdk/IHP-Open-PDK/ihp-sg13g2/libs.tech/klayout/tech/pymacros/../../python/sg13g2_pycell_lib/ihp/npn13G2V_code.py", line 250, in genLayout
    groupId = ihpCopyFig(groupId, Point(2.34, 0), 'R0')
  File "/opt/pdk/IHP-Open-PDK/ihp-sg13g2/libs.tech/klayout/tech/pymacros/../../python/sg13g2_pycell_lib/ihp/geometry.py", line 1186, in ihpCopyFig
    cons(newList, dbCopyShape(item, pnt, rot))
  File "/opt/pdk/IHP-Open-PDK/ihp-sg13g2/libs.tech/klayout/tech/pymacros/../../python/sg13g2_pycell_lib/ihp/geometry.py", line 187, in dbCopyShape
    dbMoveFig(copyId, pnt, rot)
  File "/opt/pdk/IHP-Open-PDK/ihp-sg13g2/libs.tech/klayout/tech/pymacros/../../python/sg13g2_pycell_lib/ihp/geometry.py", line 199, in dbMoveFig
    fig.moveBy(pnt.x, pnt.y)
  File "/opt/pdk/IHP-Open-PDK/ihp-sg13g2/libs.tech/klayout/tech/pymacros/../../python/pycell4klayout-api/source/python/cni/polygon.py", line 75, in moveBy
    dataBaseUnits).to_simple_polygon().to_dtype(Tech.get(Tech.techInUse).dataBaseUnits)
AttributeError: 'SimplePolygon' object has no attribute 'to_simple_polygon'
The last error can be fixed by removing 'to_simple_polygon()' in 'ihp-sg13g2/libs.tech/klayout/python/pycell4klayout-api/source/python/cni/polygon.py' to this:
Copy code
def moveBy(self, dx: float, dy: float) -> None:
        movedPolygon = (pya.DTrans(float(dx), float(dy)) * self._polygon).to_itype(Tech.get(Tech.techInUse).
            dataBaseUnits).to_dtype(Tech.get(Tech.techInUse).dataBaseUnits)
        shape = Shape.getCell().shapes(self._shape.layer).insert(movedPolygon)
        self.destroy()
        self._polygon = movedPolygon
        self.set_shape(shape)
        self.addShape()
That seems to fix the generated .gds, but not sure if it breaks anything else. [Image](https://private-user-images.githubusercontent.com/29302845/440330605-2c26904d-1ce0-4bb0-9e04-8bf76795d9ca.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NDY0NDA1NDMsIm5iZiI6MTc0NjQ0MDI0MywicGF0aCI6Ii8yOTMwMjg0NS80NDAzMzA2MDUtMmMyNjkwNGQtMWNlMC00YmIwLTllMDQtOGJmNzY3OTVkOWNhLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTA1MDUlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwNTA1VDEwMTcyM1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWEyODg3MDVjNTNlMDVjZTdiMzg1MjRiYjU1MTlmOTRmYmJjNTQ1NDEyZGRmNTQ1YjAwZTAwYWI5OTVjMDRlYjcmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.yYGfH2aCmUu7QMmaiexjmh9AO3TSZNHH8jJccnPfJEE) <https://private-user-images.githubusercontent.com/29302845/440330606-5f2b0619-a3d1-45d5-87cc-4ebe50574620.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb2… IHP-GmbH/IHP-Open-PDK
#474 AttributeError: 'SimplePolygon' object has no attribute 'to_simple_polygon' when running pytest_cell.py Comment on issue by olisnr looks to me like the KLayout 3.0 incompatibility. if You use version 3, try the last KLayout version before 3 IHP-GmbH/IHP-Open-PDK