03-27-2013 09:24 AM
Hi,
I am failing to use a Call Executable step to run command line string to delete the file.
The file I want to delete is debug.txt in C:\Python_Code\4Simon\dist.
I can manage to run a exe file using Call Executable step but when it comes to DOS commands, failed.
Can any point me in the right direction, Please.
I have XP and TS 2012
Thanks
Simon
Solved! Go to Solution.
03-27-2013 10:15 AM
Use the following in argument expression
"cmd /c del C:\\Python_Code\\4Simon\\dist\\debug.txt"
03-28-2013 03:05 AM
Hi,
Thanks for that, it works.
Opens the door to a few more options.
Thanks
Simon
04-04-2013 05:42 AM
Hi,
Sorry to come back to this but I am unable to delete an xml file using this method.
On running TS for the first time the xml file will be deleted.
Next step is CVI code to read a hardware configuration using TFTP and the result is stored in the xml file.
Still within the CVI code I open the xml file, extract the information, display it and then close the file, no problems.
The TS sequence finishes and all comes to an end.
When I go to run the sequence again the xml will not be deleted, it is been held by TS in some way preventing it from been deleted.
Any idea as to what I am doing wrong?
Thanks
Simon
04-04-2013 05:56 AM
To ascertain that TS is holding your file, add a statement (very last step in cleanup) with the following expression:
Runstate.Engine.UnloadAllModules()
If you are able to delete the file during the next run you can be sure that TS is holding the file. This may be because you are not releasing the file reference properly or something to do with your CVI code. This will need further investigation. You could set a breakpoint in your CVI code after you have closed your file handle and try deleting it manually to ensure you can do it.
Hope this helps.
04-04-2013 06:16 AM
Hi,
Added in as requested, still unable to delete the file.
Put a breakpoint in the CVI code after the close file, still unable to delete the file.
The only times I can delete the file is the first time into TS or when TS is closed and so CVI is also closed, as I am using ddl call from TS.
Thanks
Simon
04-04-2013 08:37 AM
Is TestStand opening the file for any reason? If not, it is most likely not TestStand holding on to the file. More likely it is either your code not closing the file for every place it was opened, or some other program you might be using which is accessing the file and hasn't closed it yet. Are you perhaps opening the file more than once? Is the CloseHandle call on the file handle succeding (check the return value)? Is it the right close function for the open function you are using? Is there perhaps other code you are running from teststand that might be keeping the file open?
-Doug
04-04-2013 09:40 AM
Hi,
I should count a bit better/look harder think smarter, yes I did miss the close in the CVI code.
Thanks for the help.
Simon