Home Forums Nazca reusing layer name error

Tagged: 

This topic contains 1 reply, has 2 voices, and was last updated by  Ronald 1 month ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #5967

    Shayan
    Member

    I define a new layer in nazca. The first run is ok but from the second run I always get reusing layer name error.

    When the code nd.add_layer runs second time, it tries to add again a layer which already exists and gives error. Any one has an idea except removing the add_layer code after first run?

    Thanks

    #5969

    Ronald
    Keymaster

    Dear Shayan,

    It seems the memory is not cleared between runs. It then looks to Nazca like you are defining the same layer twice. If you work in Spyder you can tag the option:
    “Tools/Preferences/Run/Remove all variables before execution”.

    You can also remove all layers explicitly in Nazca using

    import nazca as nd
    nd.clear_layers()

    However, better is to clear the memory between runs to avoid similar issues.

    If on another occasion you actually want to overwrite an existing layer you can use the overwrite keyword since nazca-0.5.7:

    import nazca as nd
    nd.add_layer(name='layer1', layer=1)
    nd.add_layer(name='layer1', layer=1, overwrite=True)

    Ronald

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.