IDL_IDLBridge, spawn, and sftp, oh my! [message #87478] |
Wed, 05 February 2014 20:46  |
cgguido
Messages: 195 Registered: August 2005
|
Senior Member |
|
|
Hi all,
I am trying use IDL_IDLBridge to run a batch file containing spawn command that uses sftp to retrieve a file. If there is a more direct way, I would love to know. I'm on MacOSX and the sftp server is linux. and I'm using ssh public keys so i don't have to enter the password every time.
The issue is that while the file is sftp'ing, I'd like to do other things...
so an idl_idlBridge object->Execute with a /nowait seems like a good idea. Here is the code:
;;;;;;;;;;;begin code
file='myfile' ;<-generated on the fly actually
oBridge = OBJ_NEW('IDL_IDLBridge')
cmd2 = "scp server.internet.com:"+file+" ."
openw,lun, 'dummy.pro', /get_lun
printf,lun,'spawn, "'+cmd2+'"'
close, lun
obridge->execute, "@dummy.pro", /nowait
COMMAND1
COMMAND2
COMMAND3
while oBridge->status() ne 0 do wait, 0.1 ;check that oBridge is done every .1s
;now that oBridge (and the three COMMAND lines) are done, proceed...
;;;;;;;;;;;end code
so the file dummy.pro is created and contains:
spawn, "scp server.internet.com:file ."
I can run it with @ at the IDL> prompt, but the IDL_IDLBridge won't run it.
any ideas on how to make this work? or even better on how to do this better?
Many thanks,
G
|
|
|
Re: IDL_IDLBridge, spawn, and sftp, oh my! [message #87479 is a reply to message #87478] |
Wed, 05 February 2014 23:27   |
Helder Marchetto
Messages: 520 Registered: November 2011
|
Senior Member |
|
|
On Thursday, February 6, 2014 5:46:05 AM UTC+1, Gianguido Cianci wrote:
> Hi all,
>
>
>
> I am trying use IDL_IDLBridge to run a batch file containing spawn command that uses sftp to retrieve a file. If there is a more direct way, I would love to know. I'm on MacOSX and the sftp server is linux. and I'm using ssh public keys so i don't have to enter the password every time.
>
>
>
> The issue is that while the file is sftp'ing, I'd like to do other things...
>
> so an idl_idlBridge object->Execute with a /nowait seems like a good idea. Here is the code:
>
>
>
>
>
> ;;;;;;;;;;;begin code
>
> file='myfile' ;<-generated on the fly actually
>
> oBridge = OBJ_NEW('IDL_IDLBridge')
>
> cmd2 = "scp server.internet.com:"+file+" ."
>
> openw,lun, 'dummy.pro', /get_lun
>
> printf,lun,'spawn, "'+cmd2+'"'
>
> close, lun
>
> obridge->execute, "@dummy.pro", /nowait
>
>
>
>
>
> COMMAND1
>
> COMMAND2
>
> COMMAND3
>
>
>
> while oBridge->status() ne 0 do wait, 0.1 ;check that oBridge is done every .1s
>
>
>
> ;now that oBridge (and the three COMMAND lines) are done, proceed...
>
> ;;;;;;;;;;;end code
>
>
>
> so the file dummy.pro is created and contains:
>
>
>
> spawn, "scp server.internet.com:file ."
>
>
>
>
>
> I can run it with @ at the IDL> prompt, but the IDL_IDLBridge won't run it.
>
>
>
> any ideas on how to make this work? or even better on how to do this better?
>
>
>
> Many thanks,
>
> G
Hi Guido,
just a guess: it might be that idl_idlbridge is looking for @dummy.pro in the wrong directory. Try to check that (maybe with pwd).
Regards,
Helder
|
|
|
Re: IDL_IDLBridge, spawn, and sftp, oh my! [message #87480 is a reply to message #87479] |
Wed, 05 February 2014 23:49   |
Helder Marchetto
Messages: 520 Registered: November 2011
|
Senior Member |
|
|
On Thursday, February 6, 2014 8:27:58 AM UTC+1, Helder wrote:
> On Thursday, February 6, 2014 5:46:05 AM UTC+1, Gianguido Cianci wrote:
>
>> Hi all,
>
>>
>
>>
>
>>
>
>> I am trying use IDL_IDLBridge to run a batch file containing spawn command that uses sftp to retrieve a file. If there is a more direct way, I would love to know. I'm on MacOSX and the sftp server is linux. and I'm using ssh public keys so i don't have to enter the password every time.
>
>>
>
>>
>
>>
>
>> The issue is that while the file is sftp'ing, I'd like to do other things...
>
>>
>
>> so an idl_idlBridge object->Execute with a /nowait seems like a good idea. Here is the code:
>
>>
>
>>
>
>>
>
>>
>
>>
>
>> ;;;;;;;;;;;begin code
>
>>
>
>> file='myfile' ;<-generated on the fly actually
>
>>
>
>> oBridge = OBJ_NEW('IDL_IDLBridge')
>
>>
>
>> cmd2 = "scp server.internet.com:"+file+" ."
>
>>
>
>> openw,lun, 'dummy.pro', /get_lun
>
>>
>
>> printf,lun,'spawn, "'+cmd2+'"'
>
>>
>
>> close, lun
>
>>
>
>> obridge->execute, "@dummy.pro", /nowait
>
>>
>
>>
>
>>
>
>>
>
>>
>
>> COMMAND1
>
>>
>
>> COMMAND2
>
>>
>
>> COMMAND3
>
>>
>
>>
>
>>
>
>> while oBridge->status() ne 0 do wait, 0.1 ;check that oBridge is done every .1s
>
>>
>
>>
>
>>
>
>> ;now that oBridge (and the three COMMAND lines) are done, proceed...
>
>>
>
>> ;;;;;;;;;;;end code
>
>>
>
>>
>
>>
>
>> so the file dummy.pro is created and contains:
>
>>
>
>>
>
>>
>
>> spawn, "scp server.internet.com:file ."
>
>>
>
>>
>
>>
>
>>
>
>>
>
>> I can run it with @ at the IDL> prompt, but the IDL_IDLBridge won't run it.
>
>>
>
>>
>
>>
>
>> any ideas on how to make this work? or even better on how to do this better?
>
>>
>
>>
>
>>
>
>> Many thanks,
>
>>
>
>> G
>
>
>
> Hi Guido,
>
> just a guess: it might be that idl_idlbridge is looking for @dummy.pro in the wrong directory. Try to check that (maybe with pwd).
>
>
>
> Regards,
>
> Helder
Hi Guido,
to debug, try running something like this:
oBridge = OBJ_NEW('IDL_IDLBridge', output='E:\OutputLocation\out.txt')
obridge->execute, "pwd"
obj_destroy, obridge
Then have a look at the file.
I then created a file named LaunchPwd.pro with a single line in it, containing pwd.
By running the file from the "wrong" location:
oBridge = OBJ_NEW('IDL_IDLBridge', output='E:\OutputLocation\out.txt')
obridge->execute, "@LaunchPwd"
obj_destroy, obridge
I get this:
% Error opening file. File: LaunchPwd
But with:
oBridge = OBJ_NEW('IDL_IDLBridge', output='E:\OutputLocation\out.txt')
obridge->execute, "cd, 'OutputLocation\'"
obridge->execute, "@LaunchPwd"
obj_destroy, obridge
I get:
% Compiled module: PWD.
E:\Elmitec\IDL\MySoftware\DynTP
So I would only guess that you have a path related problem. But that is just a guess. In general the keyword Output is your friend in finding out what happend.
Ciao,
Helder
|
|
|
|