# Append error when running visual studio code

**URL:** <https://discuss.python.org/t/append-error-when-running-visual-studio-code/12125>\
**Category:** Python Help\
**Created:** [November 22, 2021, 2:06pm UTC](https://discuss.python.org/t/append-error-when-running-visual-studio-code/12125 "2021-11-22T14:06:57Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![wopwop](https://avatars.discourse-cdn.com/v4/letter/w/f08c70/32.png) [@wopwop](https://discuss.python.org/u/wopwop)\
**Post date:** [November 22, 2021, 2:06pm UTC](https://discuss.python.org/t/append-error-when-running-visual-studio-code/12125/1 "2021-11-22T14:06:57Z")

</div>

Hi,

I am having an error on the append function as you can see below  
Error:  
4.5.3  
INFO: Created TensorFlow Lite XNNPACK delegate for CPU.  
Traceback (most recent call last):  
File “c:/Python/TEST.py”, line 46, in   
DATA.append=((Landmark.x))  
AttributeError: ‘list’ object attribute ‘append’ is read-only

I am running this in a for loop:  
Data=  
Data.append=((Landmark.x))  
print(Data)

Thanks!

---

<div class="post-metadata">

**Author:** ![BowlOfRed](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/bowlofred/32/3379_2.png) [@BowlOfRed](https://discuss.python.org/u/BowlOfRed)\
**Post date:** [November 22, 2021, 4:29pm UTC](https://discuss.python.org/t/append-error-when-running-visual-studio-code/12125/2 "2021-11-22T16:29:54Z")

</div>

Please use three backquotes before and after your code so we can see the indentation.

`append` is a list method. To call a method you use parentheses, not an equals sign. So I think you intend:

```python
Data = []
Data.append(Landmark.x)
print(Data)

```

---

<div class="post-metadata">

**Author:** ![wopwop](https://avatars.discourse-cdn.com/v4/letter/w/f08c70/32.png) [@wopwop](https://discuss.python.org/u/wopwop)\
**Post date:** [November 22, 2021, 8:21pm UTC](https://discuss.python.org/t/append-error-when-running-visual-studio-code/12125/3 "2021-11-22T20:21:02Z")

</div>

Thank you.  
Indeed that is the code I used.  
But I still have the same error message:

`AttributeError: ‘list’ object attribute ‘append’ is read-only`

---

<div class="post-metadata">

**Author:** ![BowlOfRed](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/bowlofred/32/3379_2.png) [@BowlOfRed](https://discuss.python.org/u/BowlOfRed)\
**Post date:** [November 22, 2021, 8:24pm UTC](https://discuss.python.org/t/append-error-when-running-visual-studio-code/12125/4 "2021-11-22T20:24:22Z")

</div>

Please show your actual code. This is not the code that you pasted in your first message.

---

<div class="post-metadata">

**Author:** ![wopwop](https://avatars.discourse-cdn.com/v4/letter/w/f08c70/32.png) [@wopwop](https://discuss.python.org/u/wopwop)\
**Post date:** [November 23, 2021, 7:11am UTC](https://discuss.python.org/t/append-error-when-running-visual-studio-code/12125/5 "2021-11-23T07:11:22Z")

</div>

In terminal I get this error message:

Error:  
4.5.3  
INFO: Created TensorFlow Lite XNNPACK delegate for CPU.  
Traceback (most recent call last):  
File “c:/Python/TEST.py”, line 33, in  
Data.append=((Landmark.x))  
AttributeError: ‘list’ object attribute ‘append’ is read-only

This is the code in visual studio code:

```auto
import cv2
print(cv2. __version__ )
import mediapipe as mp
width=1280
height=720
cam=cv2.VideoCapture(0,cv2.CAP_DSHOW)
cam.set(cv2.CAP_PROP_FRAME_WIDTH,width)
cam.set(cv2.CAP_PROP_FRAME_HEIGHT,height)
cam.set(cv2.CAP_PROP_FPS, 30)
cam.set(cv2.CAP_PROP_FOURCC,cv2.VideoWriter_fourcc(*'MJPG'))

Handen=mp.solutions.hands.Hands(False,2,.5,.5,)

mpDraw=mp.solutions.drawing_utils

while True:
    ignore, frame=cam.read()    
    frameRGB=cv2.cvtColor(frame,cv2.COLOR_BGR2RGB)    
    results=Handen.process(frameRGB)    
    if results.multi_hand_landmarks != None:
        for handLandmarks in results.multi_hand_landmarks:            
            mpDraw.draw_landmarks(frame,handLandmarks,mp.solutions.hands.HAND_CONNECTIONS)         
                       
            for Landmark in handLandmarks.landmark:              
                Data=[]
                Data.append=((Landmark.x))
                print(Data)               
                print('')                          
            
    cv2.imshow('my WEBcam',frame)
    cv2.moveWindow('my WEBcam',0,0)      
    if cv2.waitKey(1) & 0xff==ord('q'):
        break
cam.release()

```

---

<div class="post-metadata">

**Author:** ![BowlOfRed](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/bowlofred/32/3379_2.png) [@BowlOfRed](https://discuss.python.org/u/BowlOfRed)\
**Post date:** [November 23, 2021, 7:30am UTC](https://discuss.python.org/t/append-error-when-running-visual-studio-code/12125/6 "2021-11-23T07:30:16Z")

</div>

> [@wopwop](#):
>
> Indeed that is the code I used.

No, it’s not. Your code is (incorrectly) using an equals sign. You are trying to assign to the append method.

```python
Data.append=((Landmark.x)) # Can't assign to a method

```

The code I posted earlier has no equals sign, so it is not the same code.

```python
Data = []
Data.append(Landmark.x) # parenthesis call the method, not assign to it
print(Data)

```

---

<div class="post-metadata">

**Author:** ![steven.daprano](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/steven.daprano/32/1083_2.png) [@steven.daprano](https://discuss.python.org/u/steven.daprano)\
**Post date:** [November 23, 2021, 8:54am UTC](https://discuss.python.org/t/append-error-when-running-visual-studio-code/12125/7 "2021-11-23T08:54:47Z")

</div>

You are still trying to run this code:

```
Data.append=((Landmark.x))

```

That is wrong. Take out the equals sign:

```
Data.append=((Landmark.x)) # WRONG! BAD! DON'T DO THIS.

Data.append(Landmark.x) # This is the way.
```

---

<div class="post-metadata">

**Author:** ![wopwop](https://avatars.discourse-cdn.com/v4/letter/w/f08c70/32.png) [@wopwop](https://discuss.python.org/u/wopwop)\
**Post date:** [November 23, 2021, 9:41am UTC](https://discuss.python.org/t/append-error-when-running-visual-studio-code/12125/8 "2021-11-23T09:41:18Z")

</div>

Thanks a lot guys!  
Did the adjustment and WORKS!  
Have a nice day!!
