# Revoke Python to Uipath - error invoking python method - solved

**URL:** <https://forum.uipath.com/t/revoke-python-to-uipath-error-invoking-python-method-solved/158615>\
**Category:** Help\
**Tags:** studio, python, activities\
**Created:** [October 12, 2019, 7:26am UTC](https://forum.uipath.com/t/revoke-python-to-uipath-error-invoking-python-method-solved/158615 "2019-10-12T07:26:42Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![damonyl](https://avatars.discourse-cdn.com/v4/letter/d/dfb087/32.png) [@damonyl](https://forum.uipath.com/u/damonyl)\
**Post date:** [October 12, 2019, 7:26am UTC](https://forum.uipath.com/t/revoke-python-to-uipath-error-invoking-python-method-solved/158615/1 "2019-10-12T07:26:43Z")

</div>

Hi all, i done alot researches to revoke python script, manage to run while download others’ project, but when comes to my own script dont work.

My script is about running thing without any input or parameter. all are in the script.

Maybe you can imagine just like excel read cell “A1” and writing “hello world” in “B1”.

Short and simple, but cant run my script. just like normal .py, import package pandas, openpyxl. have no def or any method.

error message:

 ![image](https://global.discourse-cdn.com/uipath/original/3X/a/b/abcc0b1dfe9b3471698b33a8549643eb4a862460.png)

my UiPath setting:

 ![image](https://global.discourse-cdn.com/uipath/original/3X/1/c/1c8c63ed573d2b7d2461b64d52c2c7b227377fd1.png) , tried also single load or run, but not working.

please help

---

<div class="post-metadata">

**Author:** ![vikaskulhari](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/vikaskulhari/32/57469_2.png) [@vikaskulhari](https://forum.uipath.com/u/vikaskulhari)\
**Post date:** [October 12, 2019, 7:31am UTC](https://forum.uipath.com/t/revoke-python-to-uipath-error-invoking-python-method-solved/158615/2 "2019-10-12T07:31:55Z")

</div>

@damonyl, did you check this video ? If not, please go through this first.

[![](https://global.discourse-cdn.com/uipath/original/4X/0/d/b/0dbb46e7a8ca578ad4f77212bafeebfdb23c880d.jpeg "How to Invoke Python Script in UiPath?") ](https://www.youtube.com/watch?v=v4EqbSqqPds)

#HappyRobotics

---

<div class="post-metadata">

**Author:** ![damonyl](https://avatars.discourse-cdn.com/v4/letter/d/dfb087/32.png) [@damonyl](https://forum.uipath.com/u/damonyl)\
**Post date:** [October 12, 2019, 9:31am UTC](https://forum.uipath.com/t/revoke-python-to-uipath-error-invoking-python-method-solved/158615/3 "2019-10-12T09:31:04Z")

</div>

Hi @vikaskulhari, thanks for replying but as i mentioned my script not using def or any method that need return something, so i’m afraid this doesnt helps

---

<div class="post-metadata">

**Author:** ![vikaskulhari](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/vikaskulhari/32/57469_2.png) [@vikaskulhari](https://forum.uipath.com/u/vikaskulhari)\
**Post date:** [October 12, 2019, 12:55pm UTC](https://forum.uipath.com/t/revoke-python-to-uipath-error-invoking-python-method-solved/158615/4 "2019-10-12T12:55:01Z")

</div>

alright but script must have a def.

---

<div class="post-metadata">

**Author:** ![damonyl](https://avatars.discourse-cdn.com/v4/letter/d/dfb087/32.png) [@damonyl](https://forum.uipath.com/u/damonyl)\
**Post date:** [October 12, 2019, 1:05pm UTC](https://forum.uipath.com/t/revoke-python-to-uipath-error-invoking-python-method-solved/158615/5 "2019-10-12T13:05:34Z")

</div>

do you mean add def abc in front of script?  
but now i guess the error message also matter

---

<div class="post-metadata">

**Author:** ![vikaskulhari](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/vikaskulhari/32/57469_2.png) [@vikaskulhari](https://forum.uipath.com/u/vikaskulhari)\
**Post date:** [October 12, 2019, 1:07pm UTC](https://forum.uipath.com/t/revoke-python-to-uipath-error-invoking-python-method-solved/158615/6 "2019-10-12T13:07:40Z")

</div>

can you please share your workflow and python script?

---

<div class="post-metadata">

**Author:** ![damonyl](https://avatars.discourse-cdn.com/v4/letter/d/dfb087/32.png) [@damonyl](https://forum.uipath.com/u/damonyl)\
**Post date:** [October 12, 2019, 1:18pm UTC](https://forum.uipath.com/t/revoke-python-to-uipath-error-invoking-python-method-solved/158615/7 "2019-10-12T13:18:32Z")

</div>

workflow shared in first posting.

python script:

> import pandas as pd
> 
> import openpyxl
> 
> DateToday = pd.to\_datetime(‘today’).strftime(‘%Y.%m.%d’)
> 
> col\_names =
> 
> fn = ‘C:/Users/lida8002/Desktop/python/AU\_output/MasterStep1.’+ ‘2019.09.241’+‘.xlsx’
> 
> fn1 = ‘C:/Users/lida8002/Desktop/python/AU\_output/MasterStep.Summary.’+ “2019.09.241” +‘.xlsx’
> 
> #open new folder if not exist
> 
> try:
> 
> df1 = pd.read\_excel(fn1)
> 
> except:
> 
> header = [“DBname”, “Step1 Status”, “Step2 Status”, “Step3 Status”, “Step4 Status”]
> 
> df10 = pd.DataFrame(columns=header)
> 
> writer = pd.ExcelWriter(fn1)
> 
> df10.to\_excel(writer, sheet\_name=‘Summary’, index=False)
> 
> swriter.save()

---

<div class="post-metadata">

**Author:** ![vikaskulhari](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/vikaskulhari/32/57469_2.png) [@vikaskulhari](https://forum.uipath.com/u/vikaskulhari)\
**Post date:** [October 12, 2019, 1:20pm UTC](https://forum.uipath.com/t/revoke-python-to-uipath-error-invoking-python-method-solved/158615/8 "2019-10-12T13:20:31Z")

</div>

You need to keep your py code into a def and call def in UiPath.

---

<div class="post-metadata">

**Author:** ![HareeshMR](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/hareeshmr/32/181825_2.png) [@HareeshMR](https://forum.uipath.com/u/HareeshMR)\
**Post date:** [October 12, 2019, 4:24pm UTC](https://forum.uipath.com/t/revoke-python-to-uipath-error-invoking-python-method-solved/158615/9 "2019-10-12T16:24:24Z")

</div>

Use Run Python Script first and check @damonyl?

---

<div class="post-metadata">

**Author:** ![anmolk171](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/anmolk171/32/37621_2.png) [@anmolk171](https://forum.uipath.com/u/anmolk171)\
**Post date:** [October 12, 2019, 6:47pm UTC](https://forum.uipath.com/t/revoke-python-to-uipath-error-invoking-python-method-solved/158615/10 "2019-10-12T18:47:37Z")

</div>

@damonyl - The thing is Python is a scripting language if code don’t have the class or function or definition or method but if you have used OOPS or the thing which I have mentioned it will work like programming language you are currently using it as scripting language.  
Now if you want to use something like this you can use powershell activities to run you code or you can make the batch file and invoke it using UiPath.  
Hope it will help you.

Best!!  
Anmol

---

<div class="post-metadata">

**Author:** ![damonyl](https://avatars.discourse-cdn.com/v4/letter/d/dfb087/32.png) [@damonyl](https://forum.uipath.com/u/damonyl)\
**Post date:** [October 17, 2019, 1:38am UTC](https://forum.uipath.com/t/revoke-python-to-uipath-error-invoking-python-method-solved/158615/11 "2019-10-17T01:38:48Z")

</div>

Hi all, thanks for giving your opinion, really appreciated.

Maybe let me clarify my problem and giving solution that solved mine problem.

I’m able to import package while using Anocanda, but if running with UiPath, need to pre-install in Python, where you can check it out from running Python 3.6, if your type import pandas (or any other package) it shown error, means you’ve not installed PIP yet. that’s the main reason make me failed also.

Action:- locate your python file and open “Scripts” folder, for me is (C:\Users\Damon\AppData\Local\Programs\Python\Python36\Scripts), copy this path and run CMD, type cd C:\Users\lida8002\AppData\Local\Programs\Python\Python36\Scripts and then type “pip install pandas”, replace pandas with any package you want to install.

In Uipath perspective, any script, for mine, not function or def function, still manage to run.

Activity in UiPath to be used, Load Python script and Run Python Script. that’s all

hope this helps

---

<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:** [October 20, 2019, 1:38am UTC](https://forum.uipath.com/t/revoke-python-to-uipath-error-invoking-python-method-solved/158615/12 "2019-10-20T01:38:55Z")

</div>

Closed on October 20, 2019, 1:38am UTC

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