# Invoke python method problem! cannot use .py file for all day!

**URL:** <https://forum.uipath.com/t/invoke-python-method-problem-cannot-use-py-file-for-all-day/746010>\
**Category:** Studio\
**Tags:** question, python, activities\
**Created:** [June 6, 2024, 9:58am UTC](https://forum.uipath.com/t/invoke-python-method-problem-cannot-use-py-file-for-all-day/746010 "2024-06-06T09:58:46Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![FINNNNNNNN](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/finnnnnnnn/32/510284_2.png) [@FINNNNNNNN](https://forum.uipath.com/u/FINNNNNNNN)\
**Post date:** [June 6, 2024, 9:58am UTC](https://forum.uipath.com/t/invoke-python-method-problem-cannot-use-py-file-for-all-day/746010/1 "2024-06-06T09:58:46Z")

</div>

Dear Forum,

I’m trying to use python code in UiPath,  
I want to use the function call ddddocr,  
and bellow is my .py file:

def OCRfumction(filePath):  
import ddddocr  
ocr = ddddocr.DdddOcr()  
with open(filePath, ‘rb’) as f:  
img\_bytes = f.read()  
res = ocr.classification(img\_bytes)  
return res

I always stock at Get Python Object: Error converting Python object  
please help!

---

<div class="post-metadata">

**Author:** ![FINNNNNNNN](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/finnnnnnnn/32/510284_2.png) [@FINNNNNNNN](https://forum.uipath.com/u/FINNNNNNNN)\
**Post date:** [June 6, 2024, 9:59am UTC](https://forum.uipath.com/t/invoke-python-method-problem-cannot-use-py-file-for-all-day/746010/2 "2024-06-06T09:59:33Z")

</div>

!!!This file is not the correct Answer, you cannot use it without tune your code by the next response!!!

[OCRtest.zip](https://forum.uipath.com/uploads/short-url/YftteJUWQ9tjZEcI5vGYZU9yBx.zip) (12.5 KB)

---

<div class="post-metadata">

**Author:** ![FINNNNNNNN](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/finnnnnnnn/32/510284_2.png) [@FINNNNNNNN](https://forum.uipath.com/u/FINNNNNNNN)\
**Post date:** [June 7, 2024, 2:21am UTC](https://forum.uipath.com/t/invoke-python-method-problem-cannot-use-py-file-for-all-day/746010/3 "2024-06-07T02:21:36Z")

</div>

I found the solution,  
Here is my setting

![圖片](https://global.discourse-cdn.com/uipath/original/4X/d/0/5/d05382b2ec7b2733aa128443e65ae0a602d20d1f.png)  
 ![圖片](https://global.discourse-cdn.com/uipath/original/4X/e/e/1/ee1aa3e32719d6f1e5a639fde295eb1c7aa374b1.png)

 ![圖片](https://global.discourse-cdn.com/uipath/original/4X/4/e/b/4eb7e06124e23b5a78d37b81eab88ad4a26eb1ad.png)  
 ![圖片](https://global.discourse-cdn.com/uipath/original/4X/2/f/e/2fe7ba014d8cc90ccfb94f313b930f4970c25420.png)  
 ![圖片](https://global.discourse-cdn.com/uipath/original/4X/5/6/3/56314417bc6006f3eeb33ca33188d686ec13653e.png)  
 ![圖片](https://global.discourse-cdn.com/uipath/original/4X/4/a/f/4af0598abf67c3f99ad797084fb13d319e864aff.png)  
 ![圖片](https://global.discourse-cdn.com/uipath/original/4X/a/e/3/ae3e130a83e72ed1723aac38789349c76e7f6ec6.png)  
 ![圖片](https://global.discourse-cdn.com/uipath/original/4X/8/d/6/8d6dcea05f01580da215aa5e15c477d780d74e0b.png)  
 ![圖片](https://global.discourse-cdn.com/uipath/original/4X/7/7/0/7702df2b0317528dacba14016e99f130be7ace1c.png)

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/system/32/182466_2.png) [@system](https://forum.uipath.com/u/system)\
**Post date:** [June 10, 2024, 2:22am UTC](https://forum.uipath.com/t/invoke-python-method-problem-cannot-use-py-file-for-all-day/746010/4 "2024-06-10T02:22:26Z")

</div>

Closed on June 10, 2024, 2:22am UTC

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.
