Announcements

Between mid-October and November, the content on AREA will be relocated to the Autodesk Community M&E Hub and the Autodesk Community Gallery. Learn more HERE.

ERROR : string indices must be integers, not str #

ERROR : string indices must be integers, not str #

a.barriere
Community Visitor Community Visitor
1,809 Views
1 Reply
Message 1 of 2

ERROR : string indices must be integers, not str #

a.barriere
Community Visitor
Community Visitor

Hi,

 

When starting a new scene, I have an error message in the script editor : # Error: TypeError: file mathLib.py line 5: string indices must be integers, not str #. It keeps me from installing atools . I don't know how it appeared, i tried to repair maya with the repair tool but it didn't work.

 

Working on Maya 2019, Windows 10

0 Likes
1,810 Views
1 Reply
Reply (1)
Message 2 of 2

Anonymous
Not applicable

All the characters of a string have a unique index . This index specifies the position of each character of the string. TypeError: string indices must be integers means an attempt to access a location within a string using an index that is not an integer.

 

For example, str[hello"] and str[2.1] as indexes. As these are not integers, a TypeError exception is raised. This means that when you’re accessing an iterable object like a string or float value, you must do it using an integer value .

 

Python supports slice notation for any sequential data type like lists, strings , tuples, bytes, bytearrays, and ranges. When working with strings and slice notation, it can happen that a TypeError: string indices must be integers is raised, pointing out that the indices must be integers, even if they obviously are.

 

0 Likes