Expiresolusion error

Hi,
I am trying to use the Expiresolution() in Ghpython, however, i get this message: ExpireSolution() takes exactly 2 arguments(1 given). However, when i look at the documentation, it says it takes in one bool value, if im not mistaken, also, I saw examples online that one bool value seem sufficient what went wrong? can someone help?

Thank you so much!

ExpireSolution is an instance method. You should call it on a document object instance, not on an interface.

Blockquote ExpireSolution is an instance method. You should call it on a document instance, not on an interface.

Hi, Thank you for your reply, What exactly do you mean? I’m not too familiar with this topic, could you give more hint?

You need to call it on the component for which you want to expire the solution. In your case it looks like you want to expire the solution of your Python component. Following should work:

ghdoc.Component.ExpireSolution(True)

How is this different from what you tried before?

Since this is an instance method call Python really gives ExpireSolution() the instance it is called on as first parameter. So behind the scenes essentially it is: ExpireSolution(ghdoc.Component, True) - you are just given nice syntactic sugar to write instead: ghdoc.Component.ExpireSolution(True).

1 Like