# 'NoneType' object is not subscriptable

**URL:** <https://openmc.discourse.group/t/nonetype-object-is-not-subscriptable/1791>\
**Category:** User Support\
**Created:** [March 11, 2022, 10:11am UTC](https://openmc.discourse.group/t/nonetype-object-is-not-subscriptable/1791 "2022-03-11T10:11:12Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![MAKurniwawan](https://yyz2.discourse-cdn.com/free1/user_avatar/openmc.discourse.group/makurniwawan/32/1706_2.png) [@MAKurniwawan](https://openmc.discourse.group/u/MAKurniwawan)\
**Post date:** [March 11, 2022, 10:11am UTC](https://openmc.discourse.group/t/nonetype-object-is-not-subscriptable/1791/1 "2022-03-11T10:11:12Z")

</div>

Hello everyone,

I got an error like this:

```auto

'NoneType' object is not subscriptable

```

I guess, the problem is in my core lattice universes. Can anyone tell what should I do?

Thanks,  
Aldi

---

<div class="post-metadata">

**Author:** ![paulromano](https://yyz2.discourse-cdn.com/free1/user_avatar/openmc.discourse.group/paulromano/32/486_2.png) [@paulromano](https://openmc.discourse.group/u/paulromano)\
**Post date:** [March 11, 2022, 12:35pm UTC](https://openmc.discourse.group/t/nonetype-object-is-not-subscriptable/1791/2 "2022-03-11T12:35:44Z")

</div>

This is an error from Python itself telling you that you can’t use `[]` operators on an object that is None. If you’re able to share the snippet of your code where this is happening, it would help identify what you need to fix.

---

<div class="post-metadata">

**Author:** ![MAKurniwawan](https://yyz2.discourse-cdn.com/free1/user_avatar/openmc.discourse.group/makurniwawan/32/1706_2.png) [@MAKurniwawan](https://openmc.discourse.group/u/MAKurniwawan)\
**Post date:** [March 11, 2022, 12:51pm UTC](https://openmc.discourse.group/t/nonetype-object-is-not-subscriptable/1791/3 "2022-03-11T12:51:46Z")

</div>

I have sent the code to you via private message

---

<div class="post-metadata">

**Author:** ![paulromano](https://yyz2.discourse-cdn.com/free1/user_avatar/openmc.discourse.group/paulromano/32/486_2.png) [@paulromano](https://openmc.discourse.group/u/paulromano)\
**Post date:** [March 11, 2022, 1:18pm UTC](https://openmc.discourse.group/t/nonetype-object-is-not-subscriptable/1791/4 "2022-03-11T13:18:00Z")

</div>

For a few of your lattices, you are setting the wrong attribute for universes:

```nohighlight
latkar2.universes_ = ...
...
latkar20.universes_ = ...

```

which should be:

```nohighlight
latkar2.universes = ...
...
latkar20.universes = ...

```

I can see why this confused you – the error message is not very useful in this case. I’ll look into submitting a fix that should produce a better error message in this situation.

---

<div class="post-metadata">

**Author:** ![MAKurniwawan](https://yyz2.discourse-cdn.com/free1/user_avatar/openmc.discourse.group/makurniwawan/32/1706_2.png) [@MAKurniwawan](https://openmc.discourse.group/u/MAKurniwawan)\
**Post date:** [March 11, 2022, 1:26pm UTC](https://openmc.discourse.group/t/nonetype-object-is-not-subscriptable/1791/5 "2022-03-11T13:26:05Z")

</div>

Thanks @paulromano , I get it .

Best Regard  
Aldi

---

<div class="post-metadata">

**Author:** ![MAKurniwawan](https://yyz2.discourse-cdn.com/free1/user_avatar/openmc.discourse.group/makurniwawan/32/1706_2.png) [@MAKurniwawan](https://openmc.discourse.group/u/MAKurniwawan)\
**Post date:** [March 12, 2022, 6:40am UTC](https://openmc.discourse.group/t/nonetype-object-is-not-subscriptable/1791/6 "2022-03-12T06:40:48Z")

</div>

Hi @paulromano , I have managed to get rid of the “Nonetype Subscriptable” error. However, I get another error “std::out of range stoi” when running openmc, I think that the error is in the geometry arrangement that I created. Can you help me to fix the error?

---

<div class="post-metadata">

**Author:** ![paulromano](https://yyz2.discourse-cdn.com/free1/user_avatar/openmc.discourse.group/paulromano/32/486_2.png) [@paulromano](https://openmc.discourse.group/u/paulromano)\
**Post date:** [March 14, 2022, 12:18pm UTC](https://openmc.discourse.group/t/nonetype-object-is-not-subscriptable/1791/7 "2022-03-14T12:18:33Z")

</div>

This was answered here:

> [@Std::out\_of\_range](https://openmc.discourse.group/t/std-out-of-range/1800):
>
> I made a reactor core model, but there is an error std::out\_of\_range when I run, can anyone tell me what should I do to fix it?
