cancel
Showing results for 
Search instead for 
Did you mean: 

I want to delete the input file that is in a data loop - I get the error stating the file is in use.

ppfeifer
Contributor

I want to delete the input file that is in a data loop - I get the error stating the file is in use.

How do  I make TestComplete release the input file so it can be deleted?   I use Python code for the delete code (which works) but if I run the program with the input file and then try to delete the file I get the error :

The process cannot access the file because it is being used by another process.

 

The file type is an Excel file.  The file is downloaded from SharePoint and then used as an input file.     The file needs to be deleted after the program runs so the next run can use the new file (same name) which has been updated with new data.       

I looked for a close command with aqFile   & aqfileSystem   but didn't find it in the documentation. 

The delete script is after the EOF has been reached.    Please help!

 
5 REPLIES 5
AlexKaras
Community Hero

Re: I want to delete the input file that is in a data loop - I get the error stating the file is in

Hi,

 

 in a data loop

delete script is after the EOF has been reached.

Without seen actual code my suggestion will be to try to delete the file outside of the loop.

 

Regards,
  /Alex [Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
================================
MadGrb
Contributor

Re: I want to delete the input file that is in a data loop - I get the error stating the file is in

Hi,

If you want be sure that Cursour is in EOF or File is not in use,

You can use WITH keyword in Python.

ppfeifer
Contributor

Re: I want to delete the input file that is in a data loop - I get the error stating the file is in

it is the last thing to be done after the the last record has been read.    Do you know a way to close the input file?

 

ppfeifer
Contributor

Re: I want to delete the input file that is in a data loop - I get the error stating the file is in

The delete the file is outside of the loop.   

Re: I want to delete the input file that is in a data loop - I get the error stating the file is in

I suppose the file may be locked until you close TestComplete. It is hard to say more without an example.

Regards,
Yuriy Peshekhonov
Customer Care Engineer
New Here?
Join us and watch the welcome video:
Announcements
Top Kudoed Authors