# Invoke Python Method getting error

**URL:** <https://forum.uipath.com/t/invoke-python-method-getting-error/768738>\
**Category:** Studio\
**Tags:** activities-panel, question, studio, python, activities\
**Created:** [September 23, 2024, 11:41am UTC](https://forum.uipath.com/t/invoke-python-method-getting-error/768738 "2024-09-23T11:41:35Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![bharat.c](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/bharat.c/32/496897_2.png) [@bharat.c](https://forum.uipath.com/u/bharat.c)\
**Post date:** [September 23, 2024, 11:41am UTC](https://forum.uipath.com/t/invoke-python-method-getting-error/768738/1 "2024-09-23T11:41:35Z")

</div>

I am trying to invoke this python code using invoke method activity of UiPath. This code simply extracts the data from the qr code. I have stored qr code in png format.

def extract(imagepath):  
import cv2  
# Read the image using OpenCV  
image = cv2.imread(imagepath)

```
# Initialize the QR code detector
detector = cv2.QRCodeDetector()

# Detect and decode the QR code
data, bbox, _ = detector.detectAndDecode(image)

if data:
    return data
else:
    return None

```

But I am getting error Invoke Python Method: One or more errors occurred. (Error invoking Python method). I am passing path name dynamically too. To test whether there are some installation issues or not for that I created another small sequence to invoke addition code that is working completely fine means python and .net runtime has been properly installed.

 ![Screenshot 2024-09-23 171056](https://global.discourse-cdn.com/uipath/original/4X/c/2/4/c2448f780402a2827d7d74d8898eb545bd3195bc.png)

---

<div class="post-metadata">

**Author:** ![loginerror](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/loginerror/32/22614_2.png) [@loginerror](https://forum.uipath.com/u/loginerror)\
**Post date:** [September 23, 2024, 11:50am UTC](https://forum.uipath.com/t/invoke-python-method-getting-error/768738/2 "2024-09-23T11:50:11Z")

</div>

Hi @bharat.c

Could you play a bit with the file path (hard code it for the text)? I think it might be the issue here.

Basically, it would help if you could test your script by starting with just the first line, testing, and then adding another few lines if it worked and testing again. It would help to know which part of the script is causing this issue.

---

<div class="post-metadata">

**Author:** ![bharat.c](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/bharat.c/32/496897_2.png) [@bharat.c](https://forum.uipath.com/u/bharat.c)\
**Post date:** [September 23, 2024, 12:34pm UTC](https://forum.uipath.com/t/invoke-python-method-getting-error/768738/3 "2024-09-23T12:34:46Z")

</div>

Hey Maciej,  
I tried doing this, but the error still persists.
