# Tuple Error in Python

**URL:** <https://community.unix.com/t/tuple-error-in-python/361556>\
**Category:** Programming\
**Created:** [July 22, 2016, 1:52pm UTC](https://community.unix.com/t/tuple-error-in-python/361556 "2016-07-22T13:52:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ChicagoBlues](https://community.unix.com/letter_avatar/chicagoblues/32/5_5575768a8748004e209b776fc1b2916d.png) [@ChicagoBlues](https://community.unix.com/u/ChicagoBlues)\
**Post date:** [July 22, 2016, 1:52pm UTC](https://community.unix.com/t/tuple-error-in-python/361556/1 "2016-07-22T13:52:00Z")

</div>

Hi,

I am getting the below error:

```nohighlight
AttributeError: 'tuple' object has no attribute 'field_id'

```

This line is complaining on the below code snippet:

```nohighlight
        field_list = []
        for f in source_rows:
            field_list.append(f.field_id)

```

Where source\_rows returns multiple rows of data, an field\_list being a list should append multiple valules. Some help appreciated in figuring out where I'm messing up.

Thanks,  
Aman

---------- Post updated at 03:30 PM ---------- Previous update was at 03:27 PM ----------

I hope I'm in the correct forum for Python questions.

---------- Post updated 07-22-16 at 12:52 PM ---------- Previous update was 07-21-16 at 03:30 PM ----------

Nevermind, I figured out the issue, it was with not using the library

```nohighlight
import psycopg2.extras

```

Where I was supposed to handle the tuples correctly with:

```nohighlight
psycopg2.extras.NamedTupleCursor

```

---

<div class="post-metadata">

**Author:** ![Don\_Cragun](https://community.unix.com/user_avatar/community.unix.com/don_cragun/32/2682_2.png) [@Don\_Cragun](https://community.unix.com/u/Don_Cragun)\
**Post date:** [July 22, 2016, 5:12pm UTC](https://community.unix.com/t/tuple-error-in-python/361556/2 "2016-07-22T17:12:08Z")

</div>

Thank you for letting us know how you solved it. It will help other people with the same problem you encountered figure out how to fix it.
