The reason for the error is that you did not use the correct format to add a text property.
quote from manual:
Function: add-text-properties start end props &optional object
The argument props specifies which properties to add. It should have the form of a property list (see Property Lists): a list whose elements include the property names followed alternately by the corresponding values.
However, for your specific problem, emacs has a different command:
emacs lisp manual excerpt
The following functions add a button using an overlay (see Overlays) to hold the button properties:
Function: make-button beg end &rest properties
This makes a button from beg to end in the current buffer, and returns it.
If you insist on doing it via text properties, see above link for
Function: make-text-button beg end &rest properties
Example code for specific problem:
(make-button 1 50 'action (lambda(x) (find-file "~/test.py")))