1

I am getting

Error: AttributeError : attribute is read-only (Python.Runtime.PythonException)

trying to override an existing method for the application running IronPython:

self.attribute = True

How to "unlock" the attribute so it could be overwritten with a new value?

Soviut
  • 83,904
  • 44
  • 175
  • 239
alphanumeric
  • 15,954
  • 55
  • 201
  • 355

1 Answers1

2

Most likely self.attribute uses a property. This property only has a getter method so it's read only. To make it writable, you'd have to write a setter method that writes to the private value inside the class.

https://www.programiz.com/python-programming/property

You should consider this carefully, because most likely there is a very good reason this is a read only property. You could cause a lot of unwanted side effects because the original class designer may have never intended the value to be writable.

Soviut
  • 83,904
  • 44
  • 175
  • 239