<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: List index out of range!!! in Maya Programming Forum</title>
    <link>https://forums.autodesk.com/t5/maya-programming-forum/list-index-out-of-range/m-p/10884133#M5518</link>
    <description>&lt;P&gt;The way Python indexing works is that it starts at 0, so the first number of your list would be [0]. Index Error: List index out of range means you are trying to get an item in a list that doesn't exist. It means that you are referring to n-th element of the &lt;A href="http://net-informations.com/python/ds/lists.htm" target="_blank" rel="noopener"&gt;python list&lt;/A&gt;, while the length of the list is smaller than n. whenever you get this type of error please cross check with items that comes between/middle in range, and insure that their index is not last if you get output then you have made perfect error that mentioned.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;An index in Python refers to a position within an ordered list . To retrieve an element of the list, you use the index operator ([]) . Using indexing you can easily get any element by its position.&lt;/P&gt;</description>
    <pubDate>Mon, 17 Jan 2022 06:12:08 GMT</pubDate>
    <dc:creator>murphybeck</dc:creator>
    <dc:date>2022-01-17T06:12:08Z</dc:date>
    <item>
      <title>List index out of range!!!</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/list-index-out-of-range/m-p/9706112#M5516</link>
      <description>&lt;P&gt;I have a list of objects and I need to split the list evenly into chunks of 3.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;grpSel = cmds.ls(sl = True)&lt;/P&gt;&lt;P&gt;chunk_size = 3&lt;/P&gt;&lt;P&gt;chunks = [grpSel[i+i + chunk_size] for i in range(0, len(grpSel), chunk_size)]&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm getting an error saying 'list index out of range'.&lt;/P&gt;&lt;P&gt;Image attached as a reference&lt;/P&gt;&lt;P&gt;How can I fix this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 22 Aug 2020 16:30:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/list-index-out-of-range/m-p/9706112#M5516</guid>
      <dc:creator>danispag</dc:creator>
      <dc:date>2020-08-22T16:30:35Z</dc:date>
    </item>
    <item>
      <title>Re: List index out of range!!!</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/list-index-out-of-range/m-p/9706143#M5517</link>
      <description>&lt;LI-CODE lang="general"&gt;import maya.cmds as cmds
grpSel = cmds.ls(sl = True)
chunk_size = 3
chunks = [grpSel[i:i + chunk_size] for i in range(0, len(grpSel), chunk_size)]&lt;/LI-CODE&gt;&lt;P&gt;you've just got a little typo. on that bottom lines. To get a slice out of a list you write list_name[a:b]&lt;/P&gt;</description>
      <pubDate>Sat, 22 Aug 2020 17:13:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/list-index-out-of-range/m-p/9706143#M5517</guid>
      <dc:creator>jmreinhart</dc:creator>
      <dc:date>2020-08-22T17:13:31Z</dc:date>
    </item>
    <item>
      <title>Re: List index out of range!!!</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/list-index-out-of-range/m-p/10884133#M5518</link>
      <description>&lt;P&gt;The way Python indexing works is that it starts at 0, so the first number of your list would be [0]. Index Error: List index out of range means you are trying to get an item in a list that doesn't exist. It means that you are referring to n-th element of the &lt;A href="http://net-informations.com/python/ds/lists.htm" target="_blank" rel="noopener"&gt;python list&lt;/A&gt;, while the length of the list is smaller than n. whenever you get this type of error please cross check with items that comes between/middle in range, and insure that their index is not last if you get output then you have made perfect error that mentioned.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;An index in Python refers to a position within an ordered list . To retrieve an element of the list, you use the index operator ([]) . Using indexing you can easily get any element by its position.&lt;/P&gt;</description>
      <pubDate>Mon, 17 Jan 2022 06:12:08 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/list-index-out-of-range/m-p/10884133#M5518</guid>
      <dc:creator>murphybeck</dc:creator>
      <dc:date>2022-01-17T06:12:08Z</dc:date>
    </item>
  </channel>
</rss>

