"typeerror: ambiguous overload variants - multiple method declarations match arguments in polygon.__

Dear Matthias,

This is to inform you that I found a problem with version 0.28.14 and 0.28.15

"typeerror: ambiguous overload variants - multiple method declarations match arguments in polygon.init"

The problem doe not appear up to version 0.28.13

This error appears with a python script that I am using almost every day and never had problem before.
I went back to 0.28.13 and the problem is not there.
I am using ubuntu 22.04_LTS

Please let me know in case you need the source scripts

Thank you for your great work.
Best regards
Giovanni

Comments

  • @Giovanni I need more information about this. The message says, that you are giving some parameters to the Polygon constructors that are not exactly matching one version of the initializer, but there is a choice and there are multiple candidates.

    I suspect you see the problem because of this enhancement: https://github.com/KLayout/klayout/issues/1530

    You need to tell me what are the parameters to pass to the Polygon constructor. It accepts a list of Point objects, a SimplePolygon object are a Box object. There is no change to the behavior of these flavors. Other ways may or may not work.

    The error message should also contain more information about the variants that are available.

    Matthias

  • Dear Matthias,

    I looked at the enhancement you mentioned and I think it is related to it.

    To facilitate your work, I have prepared a testcase for you.
    Please find here the script and the gds to reproduce the problem.

    The script:
    https://drive.google.com/file/d/1sO5oNAqlXLxac-3MGeqtQaLjaiaxCXh7/view?usp=sharing
    The gds:
    https://drive.google.com/file/d/1ln_YzWtUuOy-GwP07p3gqoHjgrKDcZaf/view?usp=sharing

    Please let me kno win case you are not able to access the files

    Thank you in advance
    Best regards
    Giovanni

  • Thanks, that is easy ...

    Please see this line in "create_char":

                                pg0 = pya.DPoint(  pair[0] * Dbu,  pair[1]* Dbu  )
    

    You are using the DPoint object to create a Polygon object. Basically Polygon (integer-unit polygon) is made from Point (integer-unit as well) while DPoint (micrometer-unit point, by convention) goes into DPolygon (micrometer-unit polygon).

    So far, DPoint was implicitly converted to Point which appears not to be working anymore (I can't reproduce that for me, but maybe there is a dependency on the Python version). Anyway, this is bad style anyway, so you should simply replace pya.DPoint by pya.Point and things should work again.

    Matthias

  • THANK YOU Matthias.
    I changed the pya.DPoint to pya.Point and now it works perfectly.

    Thank you again
    Giovanni

Sign In or Register to comment.