• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Finder crash on duplicate file statement
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Finder crash on duplicate file statement


  • Subject: Re: Finder crash on duplicate file statement
  • From: KOENIG Yvan <email@hidden>
  • Date: Sat, 11 Sep 2010 16:16:05 +0200


Le 11 sept. 2010 à 15:58, Jim Brandt a écrit :

I have a script that runs daily on my desktop machine (PowerMac running 10.4.11). Occasionally it crashes with an error -609 Finder got an error: connection is invalid. When this happens, the Finder has crashed and relaunched. I have never before been able to track down the circumstances that cause this (the frequency is about twice a month).

I'm testing this script on my MacBook (running 10.6.4), and it is crashing every time at the same place. The crash happens trying to copy a file from one folder to another. After the crash, I have a grayed-out file in the folder I'm trying to copy to with a size of zero bytes. Trying to delete the file results in an error saying the file is in use.

It just so happens that I have run a Perl script on the same file a few steps before. Is it possible the reason for the crash is that Perl still has the file open? If so, is there a way to ensure that Perl is done before doing the copy? It shouldn't take very long as the file being worked on is less than 1000 bytes in size. If it's not Perl having the file open, any suggestions as to what it might be?

Here's a snippet of code from the script where the error is happening. The error occurs on the "duplicate file Index_file ..." statement in the try block. All of this is inside a Tell Application "Finder" block.

set MactoDOS to "'s/\\015/\\015\\012/g'"
set POSIXFileName to POSIX path of file Index_file
set cmd to "perl -i -pe " & MactoDOS & " \"" & POSIXFileName & "\""
do shell script (cmd)

-------------------------------------------------------------------------------------------------
set step to "Step 13"
set mess to step & " - Copy " & Index_file & " to " & f_MainFolder
TextLib's Message(mess, logfile)

try
duplicate file Index_file to folder f_MainFolder with replacing
on error the error_message number the error_number
set mess to "Error in " & step & ": " & the error_number & ". " & the error_message
TextLib's Message(mess, logfile)
my do_error(error_number, mess)
end try

Hello

It's not clear in your message.
Is your code encapsulated in a tell Finder block ?

When I wish to check that a copy process is ended, I use a loop checking that the physical size no longer change.

tell application "System Events" to tell disk item "path_2_my_file"
set old_size to -1
repeat 
delay .5
set new_size to physical size
if new_size = old_size then exit repeat
set old_size to new_size
end repeat
end tell

Yvan KOENIG (VALLAURIS, France) samedi 11 septembre 2010 16:15:59



 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

References: 
 >Finder crash on duplicate file statement (From: Jim Brandt <email@hidden>)

  • Prev by Date: Finder crash on duplicate file statement
  • Next by Date: Re: Finder crash on duplicate file statement
  • Previous by thread: Finder crash on duplicate file statement
  • Next by thread: Re: Finder crash on duplicate file statement
  • Index(es):
    • Date
    • Thread