Employee

unable to execute command using tSystem component

Hello

 

I am able to execute the following aws command at my local machine's command prompt:

 

aws s3 ls s3://pmassieh.talend.s3.bucket

 

aws_command.png

 

However when I attempt to execute the same command from the tSystem component inside a job that runs on the same local machine:

 

tsystem_component.png

 

I get error:

 

'aws' is not recognized as an internal or external command,
operable program or batch file.
.------.
|tLogRow_2|
|=----=|
|output|
|=----=|
|null  |
'------'

[statistics] disconnected
Job s3 ended at 19:11 20/03/2018. [exit code=0]

 

Am I missing anything here ?

 

Appreciate your help

 

Thanks

 

Patrice

Tags (4)
8 REPLIES
Fifteen Stars

Re: unable to execute command using tSystem component

Have you tried changing your aws command to include it's full path? I suspect that aws is not in your PATH variable.

Rilhia Solutions
Employee

Re: unable to execute command using tSystem component

yes in the tSystem Component I set the home directory where the aws executable resides . See screen shot, but still to no avail...

Fifteen Stars

Re: unable to execute command using tSystem component

That is the location where cmd is started. I don't believe it will be where cmd's working directory will be when it opens.

Rilhia Solutions
Employee

Re: unable to execute command using tSystem component

How do I find out the commands working directory then ?
Fifteen Stars

Re: unable to execute command using tSystem component

I can't test this as i don't have AWS on my machine and I am using a Mac (so the command will be different), but this may work for you....

 

"cmd /c \"c:program files/Amazon/AWSCLI/awscli/aws\" s3 ls s3://" + context.S3_Bucket
Rilhia Solutions
Employee

Re: unable to execute command using tSystem component

Thanks Rich

 

I tried that:

 

"cmd /c \"C:/Program Files/Amazon/AWSCLI/awscli/aws\" s3 ls s3://" + context.S3_Bucket

 

but still getting :

 

'C:/Program' is not recognized as an internal or external command,
operable program or batch file.
.------.
|tLogRow_2|
|=----=|
|output|
|=----=|
|null  |
'------'
[statistics] disconnected
Job s3 ended at 07:33 21/03/2018. [exit code=0]

 

So looks like the space is the issue and is not being recognized...

 

Fifteen Stars

Re: unable to execute command using tSystem component

Yes the space in the name is what would cause that, but I was hoping the quotes would prevent that causing an issue. As they would if you were to actually use that command in the command-line. The other thing to try is to add the path to AWS to your PATH operating system variable. Do that, restart Studio and run your original attempt and it should work.

 

The tSystem component is arguably the worst implemented component by Talend. I seldom use it and use Java instead because it makes things unnecessarily complicated. The other thing to try is to prepare a  .bat file (maybe using your Talend job) and call it from the tSystem. Then you simply have to carry out a simple call and leave the .bat to do the hard work. 

Rilhia Solutions
Employee

Re: unable to execute command using tSystem component

Thanks Richard. I will try that. Thanks for your help so far.