# Python function that creates csv

**URL:** <https://forum.uipath.com/t/python-function-that-creates-csv/468840>\
**Category:** Activities\
**Tags:** question, python, activities\
**Created:** [August 29, 2022, 6:58pm UTC](https://forum.uipath.com/t/python-function-that-creates-csv/468840 "2022-08-29T18:58:59Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![michael.zura](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/michael.zura/32/263764_2.png) [@michael.zura](https://forum.uipath.com/u/michael.zura)\
**Post date:** [August 29, 2022, 6:58pm UTC](https://forum.uipath.com/t/python-function-that-creates-csv/468840/1 "2022-08-29T18:58:59Z")

</div>

Hello, I have Python Scope and Run Python Script activities. The Python function “report\_genertor()” works fine manually running in IDE, takes csv file and using pandas groups and calculates data, then writes to csv file. When I run the program in UiPath, I get the following error:  
RemoteException wrapping System.InvalidOperationException: Error initializing Python engine —\> RemoteException wrapping System.InvalidOperationException: Python instantiation exception  
Python Invoker program exception:  
Exception has been thrown by the target of an invocation.

at UiPath.Shared.Service.PythonResponse.ThrowExceptionIfNeeded()  
at UiPath.Python.Service.PythonProxy.Initialize(String path,  
Version version,  
String workingFolder)  
at UiPath.Python.Impl.OutOfProcessEngine.Initialize(String workingFolder,  
CancellationToken ct,  
Double timeout)  
at UiPath.Python.Activities.PythonScope.d\_\_36.MoveNext()  
— End of inner exception stack trace —  
at UiPath.Shared.Activities.AsyncTaskNativeImplementation.BookmarkResumptionCallback(NativeActivityContext context,  
Object value)  
at UiPath.Shared.Activities.AsyncTaskNativeActivity.BookmarkResumptionCallback(NativeActivityContext context,  
Bookmark bookmark,  
Object value)  
at System.Activities.Runtime.BookmarkCallbackWrapper.Invoke(NativeActivityContext context,  
Bookmark bookmark,  
Object value)  
at System.Activities.Runtime.BookmarkWorkItem.Execute(ActivityExecutor executor,  
BookmarkManager bookmarkManager)  
I have tried running the Python function in UiPath from where python.exe file is located as well as using the venv location, I think the problem might be importing Pandas. Can anyone give me any advice or suggestions please? Thank you
