Hello
I have this strange error i cant figure out. this is my flow:
i am downloading file from gmail and using it then for processing i am accessing it in temp folder but i found out that it uses sort of double extension and i was thinking this is the problem:
here i am renaming it (and then as can be seen in previous activity i am moving that file so that it will be just with normal jpg
now i am loading this into python script for further processing:
so i am using the correct value for the file to be accessed with correct extension.
but i am still getting this error:
RemoteException wrapping System.AggregateException: One or more errors occurred. (Error invoking Python method) —> RemoteException wrapping System.InvalidOperationException: Error invoking Python method —> RemoteException wrapping System.InvalidOperationException: Python instantiation exception
Python Invoker program exception:
ValueError : unknown file extension:
at UiPath.Shared.Service.PythonResponse.ThrowExceptionIfNeeded()
at UiPath.Python.Service.PythonProxy.InvokeMethod(Guid instance,
String method,
IEnumerable1 args) at UiPath.Python.Impl.OutOfProcessEngine.<>c__DisplayClass15_0.<InvokeMethod>b__0() at System.Threading.Tasks.Task
1.InnerInvoke()
at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread,
ExecutionContext executionContext,
ContextCallback callback,
Object state)
— End of stack trace from previous location —
at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread,
ExecutionContext executionContext,
ContextCallback callback,
Object state)
at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot,
Thread threadPoolThread)
— End of stack trace from previous location —
at UiPath.Python.Activities.InvokeMethod.ExecuteAsync(AsyncCodeActivityContext context,
CancellationToken cancellationToken)
— End of inner exception stack trace —
at UiPath.Python.Activities.InvokeMethod.ExecuteAsync(AsyncCodeActivityContext context,
CancellationToken cancellationToken)
— End of inner exception stack trace —
at UiPath.Shared.Activities.AsyncTaskCodeActivity.EndExecute(AsyncCodeActivityContext context,
IAsyncResult result)
at System.Activities.AsyncCodeActivity.CompleteAsyncCodeActivityData.CompleteAsyncCodeActivityWorkItem.Execute(ActivityExecutor executor,
BookmarkManager bookmarkManager)
this is the snippet i am using and it works on cmd actually run on exact same file i am having there in temp:
import pytesseract
from PIL import Image
import os
# Set the tesseract executable path
pytesseract.pytesseract.tesseract_cmd = r"C:\Program Files\Tesseract-OCR\tesseract.exe"
def rotate_and_correct_image(In_FilePath):
In_OutputPath = ""
original_image = Image.open(In_FilePath)
osd = pytesseract.image_to_osd(original_image)
rotation_angle = int([line.split(":")[1].strip() for line in osd.split("\n") if "Rotate" in line][0])
corrected_image = original_image.rotate(-rotation_angle, expand=True)
corrected_image.save(In_OutputPath)
return In_OutputPath # Return the output file path
Any help would be very appreciated.