cancel
Showing results for 
Search instead for 
Did you mean: 

Running curl-command from Blueprism

CarstenClaussen
Level 2
Hi!  I'm trying to run a Curl-command from within a batch-file using the "Utility - Environment" VBO (Action Start Process). Running the batch-file from command-shell manually runs like charm, but when called from Blueprism I get the following error message: "Internal : Could not execute code stage because exception thrown by code stage: The system cannot find the file specified". When pausing after batch-file execution I get this message: "c:\windows\system32\curl.exe' is not recognized as an internal or external command" I suspect this could be a permission related issue.   Any ideas?  
6 REPLIES 6

JiriPospisil
Level 4
Hi, I think that some time ago it helped me when I instead used action 'Run Process Until Ended' and provide it 'Working Folder' input.

Has anyone else had this issue?

I had the same issue when I moved from my dev environment to testing environment.

------------------------------
Anthony Camargo
Senior RPA Consultant
Princeton Blue
America/New_York
------------------------------

Hi,

I struggled with same issue as Anthony. This worked for me:

Check that following folders contains curl.exe -file:

C:\Windows\System32\

C:\Windows\SysWOW64\ 

If curl.exe is only at one folder, just make sure that both folders have the same .exe -file.

How this came to mind:  .bat (which includes curl) worked fine when launched manually via file explorer but when running it via BP, it claims that cURL is not recognized as a .... command. Seems that File explorer launches cmd.exe in 32bit and BP launches cmd as 64bit and in my case, 64-bit folder did not included the curl.exe -file...

Idk, is this a permanent solution but at least it worked for us!



------------------------------
Mikko Rahikainen
RPA Manager
S-Group
Europe/Helsinki
------------------------------

Thanks for the response!!

To solve this we also intalled the CURL.exe file in a folder and then added the path to the curl.exe to the global environment variable "Path" so that it would be found when opened up from Blue Prism.

Thanks,

Anthony

------------------------------
Anthony Camargo
Senior RPA Consultant
Princeton Blue
America/New_York
------------------------------

AndreyKudinov
Level 10

I didnt bother with standard VBOs, just made my own stuff.

Process process = new Process();
process.StartInfo.FileName = cmd;
process.StartInfo.Arguments = args;
process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
process.StartInfo.CreateNoWindow = true;
process.StartInfo.UseShellExecute = false;
process.StartInfo.RedirectStandardOutput = true;
process.StartInfo.RedirectStandardError = true;
process.StartInfo.StandardOutputEncoding = Encoding.GetEncoding(decimal.ToInt32(encoding));
process.StartInfo.StandardErrorEncoding = Encoding.GetEncoding(decimal.ToInt32(encoding));
process.Start();
//* Read the output (or the error)
var output = process.StandardOutput.ReadToEndAsync();
var error = process.StandardError.ReadToEndAsync();
process.WaitForExit();
process.Close();
stdout = output.Result;
stderr = error.Result;


Then just pass full path to curl in cmd and whatever you need in args, encoding is 65001(UTF-8) for curl binary I think. stderr/stdout is your output streams.



------------------------------
Andrey Kudinov
Project Manager
MobileTelesystems PJSC
Europe/Moscow
------------------------------

Walter.Koller
Level 11
When not other specified (user profile, environment settings, ...) the shell is opened where cmd.exe is located. 
It should work when working directory is specified. 

Alternatively you can use change directories in your script file or use absolute paths.
If you are into Windows scripting, you can first evaluate the location of the started bat file and then dynamically build the absolute paths.

I would not recommend to copy any files to Windows system folders. I also don't like using PATH environment variables, in the end I won't know where (or which if there are copies) the script file is that was run.
Sometimes we cannot avoid using scripts. In those cases, we have a well defined folder structure and only use absolute paths. The folder structure is replicated to all of our runtime resources, so we can be sure it will run no matter what.

------------------------------
Walter Koller
Solution Manager
Erste Group IT International GmbH
Europe/Vienna
------------------------------