Forum Discussion

ppfeifer's avatar
ppfeifer
Contributor
3 years ago

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

  • YuriPeshekhonov's avatar
    YuriPeshekhonov
    SmartBear Alumni (Retired)

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

  • AlexKaras's avatar
    AlexKaras
    Champion Level 3

    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.

     

    • ppfeifer's avatar
      ppfeifer
      Contributor

      The delete the file is outside of the loop.   

  • 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's avatar
      ppfeifer
      Contributor

      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?