# System.InvalidOperationException while loading Python Script

**URL:** <https://forum.uipath.com/t/system-invalidoperationexception-while-loading-python-script/109014>\
**Category:** Help\
**Tags:** python, activities\
**Created:** [10.Апрель.2019 14:33:25 UTC](https://forum.uipath.com/t/system-invalidoperationexception-while-loading-python-script/109014 "2019-04-10T14:33:25Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Claire\_RPA](https://avatars.discourse-cdn.com/v4/letter/c/3be4f8/32.png) [@Claire\_RPA](https://forum.uipath.com/u/Claire_RPA)\
**Post date:** [10.Апрель.2019 14:33:25 UTC](https://forum.uipath.com/t/system-invalidoperationexception-while-loading-python-script/109014/1 "2019-04-10T14:33:25Z")

</div>

Hi !  
I am getting a System.InvalidOperationException while trying to load a very simple Python script.

I’ve installed Python 3.6 32 bit inside my project folder, so the python executable is at _Python/python.exe_ path from the root folder.  
I don’t have any issue running or importing my script from the Powershell command line. I reproduced the error even with an extremely basic script: I’ve attached an example of a workflow and a python script (as a zip file) that throw the error.

Here is the error from the logs:

> Exception Type: System.InvalidOperationException
> 
> An ExceptionDetail, likely created by IncludeExceptionDetailInFaults=true, whose value is:  
> System.InvalidOperationException: Error loading Python script ----\> System.ServiceModel.FaultException`1[System.ServiceModel.ExceptionDetail]: Une exception a été levée par la cible d’un appel.
> 
> Server stack trace:  
> at System.ServiceModel.Channels.ServiceChannel.ThrowIfFaultUnderstood(Message reply, MessageFault fault, String action, MessageVersion version, FaultConverter faultConverter)  
> at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)  
> at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object ins, Object outs, TimeSpan timeout)  
> at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)  
> at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
> 
> Exception rethrown at [0]:  
> at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)  
> at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)  
> at UiPath.Python.Service.IPythonService.LoadScript(String code)  
> at UiPath.Python.Impl.OutOfProcessEngine.\<\>c\_\_DisplayClass11\_0.b\_\_0()  
> at System.Threading.Tasks.Task`1.InnerInvoke()  
> at System.Threading.Tasks.Task.Execute()

It would be amazing if someone could help me.  
Thank you !

[test.zip](https://global.discourse-cdn.com/uipath/original/3X/7/3/73b0dd1b4fc48245923a3e754d7575b7a588a64f.zip) (217 Bytes)  
[testPython.xaml](https://global.discourse-cdn.com/uipath/original/3X/0/d/0de4beb2cedd20fcb72d6c8ef9a0f772c99d8372.xaml) (5.7 KB)

PS: I have answered another topic with the exact same error as mine here : [Load Python Script Error](https://forum.uipath.com/t/load-python-script-error/77636), but it does not seem to be visited anymore, therefore I’m opening this new topic.

---

<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:** [17.Апрель.2019 08:40:06 UTC](https://forum.uipath.com/t/system-invalidoperationexception-while-loading-python-script/109014/2 "2019-04-17T08:40:06Z")

</div>

Hi @Claire_RPA

Could you try this solution:

> [@Trying to get the python activities pack to work](https://forum.uipath.com/t/trying-to-get-the-python-activities-pack-to-work/94066/2):
>
> I solved it! Never been more proud of a simple answer… When specifying the path of your Python installation (in the “Python Scope” activity), make sure to use double backslashes to escape the first one. So instead of: “C:\Users\username\AppData\Local\Programs\Python\Python36” you actually need to do… “C:\\Users\\username\\AppData\\Local\\Programs\\Python\\Python36”

Or at least giving the absolute path to the folder in which the .exe file is? (Please note how the .exe file is not part of the actual path, I saw this being an issue for others in the past)

---

<div class="post-metadata">

**Author:** ![Claire\_RPA](https://avatars.discourse-cdn.com/v4/letter/c/3be4f8/32.png) [@Claire\_RPA](https://forum.uipath.com/u/Claire_RPA)\
**Post date:** [17.Апрель.2019 10:24:53 UTC](https://forum.uipath.com/t/system-invalidoperationexception-while-loading-python-script/109014/3 "2019-04-17T10:24:53Z")

</div>

Hi @loginerror !

Thank you very much for your answer, putting in the absolute path to the folder of the .exe file indeed solves the problem entirely !

---

<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:** [20.Апрель.2019 10:24:56 UTC](https://forum.uipath.com/t/system-invalidoperationexception-while-loading-python-script/109014/4 "2019-04-20T10:24:56Z")

</div>

Закрыл(а) тему 20.Апрель.2019 10:24:56 UTC

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