1. Wacky hack
    Devshed Novice (500 - 999 posts)

    Join Date
    Apr 2001
    London, England
    Rep Power

    TypeError for int with read-only attributes?

    Hullo, I've got some code that keeps putting out the following error:

    PHP Code:
    Traceback (most recent call last):
    File "./quickrip.py"line 174in updateTrack
    .track.size self.fileSize.text()
    TypeError'int' object has only read-only attributes (assign to .size
    self.track.size is assigned as a string object, and is later copied to be an int object when I need it as an int. I can't see why it wouldn't be mutable, so why do I keep getting this error
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2001
    Houston, TX
    Rep Power
    Er, because you can't modify the size of an int. They are pretty much one size fits all If you need to alter the behavior of something based on the type of the variable, use the type() function to do type-checking first and then act accordingly.
    Debian - because life's too short for worrying.
    Best. (Python.) IRC bot. ever.

IMN logo majestic logo threadwatch logo seochat tools logo