[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 294
  • Last Modified:

CFILE ACTION ="READ" error 32

Hi,

I have a CFEXECUTE  in my code which creates  one outputfile on the server. A few steps later i've CFFILE ACTION="READ" for which I get a CF error as follows:

Error processing CFFILE.Error attempting to read c:\Inetpub\wwwroot\announcement\envl_check\2003J27512170000159377.txt.The process cann't access the file because it is being used by another process (error 32)

The error occurred while processing an element with a general identifier of (CFFILE),occupying document position (210:1) to (210:116)

Any Clue what's going wrong?

CODE is as follows:

<CFEXECUTE NAME="#Local.DirPath#\dll\wavenv.exe"    
      ARGUMENTS='-c -p1000 "#Local.DirPath#\announcement\wav_temp\#Local.FileName#"'
        OUTPUTFILE="#Local.DirPath#announcement\envl_check\#Local.AnnNewName#.txt"    
      TIMEOUT="10">
</CFEXECUTE>

<!--- Read the output from the envelope detector into a variable --->
<cffile action="READ" file="#Local.DirPath#announcement\envl_check\#Local.AnnNewName#.txt" variable="envelope_list">

Regards
Swati



0
swatis
Asked:
swatis
1 Solution
 
PE_CF_DEVCommented:
The cffile tag is executed as soon as ColdFusion does the cfexecute. So while your wavenv.exe is creating the file still coldfusion is trying to read it.  You'll have to come up with a way to wait for that file to become available. Also you want to make sure that the exe is closing the file once it is created and done with.

On possible way of doing things (probably not the best):

<cfloop condition="proccessing eq 1">
      <cfset proccessing = 0>
      <cftry>
      <cffile action="READ" file="#Local.DirPath#announcement\envl_check\#Local.AnnNewName#.txt" variable="envelope_list">
            <cfcatch type="any">
            <cfset proccessing = 1>
            </cfcatch>
      </cftry>
</cfloop>
0
 
proceptCommented:
Hi,

PE_CF_DEV is right about the conflict between wavenv.exe and cffile. But, the loop could go on forever if something goes wrong. Better add a time out to it:

<cfset processing=1>
<cfset start = now()>
<!--- should exit if file can be read or after 15 secs. --->
<cfloop condition="processing EQ 1 AND DateDiff("s", start, now()) LTE 15>
   <!--- rest of code like above --->
 </cfloop>

HTH,

Chris

0
 
swatisAuthor Commented:
Hello
Sorry for the late relpy but the problem was with exe itself.At last found it
0
 
PashaModCommented:
PAQed, with points refunded (40)

PashaMod
Community Support Moderator
0

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now