Quantcast
Channel: UiPath Community Forum - Topics tagged error
Viewing all articles
Browse latest Browse all 4384

Python function returns null?

$
0
0

@subo wrote:

Hello, Everyone

I’ve been this issue almost week. I really want to know what is the problem, please help me out!

I’ve got python script that handle with word proccessing. Given document file there are staff names. Below code is for find to staff names and looping for python dictionary(empList), if staff names found then append id to empty array(empID) . Below code is working fine in the python shell but problem is when i return empID to UiPath the response is null!

def getNames(filename=None):
    empList = {
        'name1': 'id1',
        'name2': 'id2',
        'name3': 'id3'
    }
    empID = []

    doc = docx.Document(filename)
    paragraphs = doc.tables[1]._cells[1].paragraphs
    for i in range(len(paragraphs)):
        encoded_object = paragraphs[i].text.encode(encoding='utf-8')
        text = encoded_object.decode('utf-8','ignore')
        result = re.search(r'[.]\w+', text)
        names = text[result.start() + 1: result.end()]
        for key, value in empList.items():
            if names in key:
                empID.append(value)
    return empID

Posts: 2

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 4384

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>