"permission denied"


#1

Hi,
I’m frustrated with one of my Ruby scripts. It’s an image processing
script that converts [sometimes thousands] of images and then HTTPs on
to archival servers. I continue to get a “permission denied” error on
one out of many files. Below is a subset of the PNG portion of my
script, with the error in question. All of the TIFFs, EPSs, and PDFs
were sent successfully. I just don’t understand why some files get this
error. Obviously, it stops the whole script.

Thanks,
Peter


success = ProdOrca.sendPNG pngfile
if success == true then
ftpfile = File.new(filesuccess, “w”)
ftp.putbinaryfile(filesuccess)
ftpfile.close
File.open(“E:/logs/StatusReports/InfoConFiles.log”, …
else
ftpfile = File.new(fileerror, “w”)
ftp.putbinaryfile(fileerror)
ftpfile.close
File.open(“E:/logs/StatusReports/InfoConFiles.log”, …
end
FileUtils.rm(pngfile) <----- This is what it’s complaining about.

Exception: Permission denied - EC11SE91-043.png


#2

2009/2/20 Peter B. removed_email_address@domain.invalid:

FileUtils.rm(pngfile) <----- This is what it’s complaining about.

Exception: Permission denied - EC11SE91-043.png

This may sound silly, but do you really have write permissions to
those files? I don’t think it’s about your script. You can’t delete a
file if you don’t have write permission to it.


#3

On Feb 20, 2:46 pm, Peter B. removed_email_address@domain.invalid wrote:

Hi,
I’m frustrated with one of my Ruby scripts. It’s an image processing
script that converts [sometimes thousands] of images and then HTTPs on
to archival servers. I continue to get a “permission denied” error on
one out of many files. Below is a subset of the PNG portion of my
script, with the error in question. All of the TIFFs, EPSs, and PDFs
were sent successfully. I just don’t understand why some files get this
error. Obviously, it stops the whole script.

Are you running on Windows and using a virus scanner? We’ve seen very
similar problems with Symantec Antivirus on Windows XP. Only solutions
are to disable the virus scanner OR “retry” deleting the file until it
works.


#4

Choi, Junegunn wrote:

2009/2/20 Peter B. removed_email_address@domain.invalid:

FileUtils.rm(pngfile) <----- This is what it’s complaining about.

Exception: Permission denied - EC11SE91-043.png

This may sound silly, but do you really have write permissions to
those files? I don’t think it’s about your script. You can’t delete a
file if you don’t have write permission to it.

Thanks for your reply. Yes, I do have permission. I’m a full
administrator of this server and everything on it. It’s a Windows
server.


#5

Lars C. wrote:

On Feb 20, 2:46�pm, Peter B. removed_email_address@domain.invalid wrote:

Hi,
I’m frustrated with one of my Ruby scripts. It’s an image processing
script that converts [sometimes thousands] of images and then HTTPs on
to archival servers. I continue to get a “permission denied” error on
one out of many files. Below is a subset of the PNG portion of my
script, with the error in question. All of the TIFFs, EPSs, and PDFs
were sent successfully. I just don’t understand why some files get this
error. Obviously, it stops the whole script.

Are you running on Windows and using a virus scanner? We’ve seen very
similar problems with Symantec Antivirus on Windows XP. Only solutions
are to disable the virus scanner OR “retry” deleting the file until it
works.

Thanks for your replay. Yes, unfortunately, our IT staff uses Norton
Anti-Virus on this Windows server. I personally use Nod32 on my PC, but,
I don’t think I have a choice on the server. But, I will see if I can
turn Norton off temporarily while I run my script.


#6

Hassan S. wrote:

On Fri, Feb 20, 2009 at 5:46 AM, Peter B. removed_email_address@domain.invalid wrote:

error. Obviously, it stops the whole script.

Exception: Permission denied - EC11SE91-043.png

Why “obviously”? Can’t you just rescue that exception, log the error,
and continue (or retry, if that makes more sense)? :slight_smile:

Well, I’ve already spent a week or so putting in exception handling for
other parts of this script. I’m not very good at exception handling,
frankly. I guess I can try to do it for this as well. But, I still would
like to know why it’s having the problem in the first place. What I’m
doing now is simply doing smaller batches of files. Instead of doing
1,200 files at once, I’m doing about a hundred at a time. Thanks.


#7

On Fri, Feb 20, 2009 at 5:46 AM, Peter B. removed_email_address@domain.invalid wrote:

error. Obviously, it stops the whole script.

Exception: Permission denied - EC11SE91-043.png

Why “obviously”? Can’t you just rescue that exception, log the error,
and continue (or retry, if that makes more sense)? :slight_smile:


#8

Peter B. wrote:

Hi,
I’m frustrated with one of my Ruby scripts. It’s an image processing
script that converts [sometimes thousands] of images and then HTTPs on
to archival servers. I continue to get a “permission denied” error on
one out of many files.

Why not implementing something like the following to salvage your
processing, document (LOG) the problem and deal with it latter:


success = ProdOrca.sendPNG pngfile
if success == true then
ftpfile = File.new(filesuccess, “w”)
ftp.putbinaryfile(filesuccess)
ftpfile.close
File.open(“E:/logs/StatusReports/InfoConFiles.log”, …
else
ftpfile = File.new(fileerror, “w”)
ftp.putbinaryfile(fileerror)
ftpfile.close
File.open(“E:/logs/StatusReports/InfoConFiles.log”, …
end
####### Salvage your operation and log the problematic files ######
begin
FileUtils.rm(pngfile) <----- This is what it’s complaining about.
rescue
puts “LOG: #{File.expand_path(file)} can not be handled”
end


#9

FileUtils.rm(pngfile) <----- This is what it’s complaining about.

Exception: Permission denied - EC11SE91-043.png

that usually means that some process still has the file open. You could
use something like unlocker to try to determine if it has a lock on it.
-=r


#10

Roger P. wrote:

FileUtils.rm(pngfile) <----- This is what it’s complaining about.

Exception: Permission denied - EC11SE91-043.png

that usually means that some process still has the file open. You could
use something like unlocker to try to determine if it has a lock on it.
-=r

Thanks, Roger. I’ll google around to see what “unlocker” is. Never heard
of it.


#11

Igor P. wrote:

Peter B. wrote:

Hi,
I’m frustrated with one of my Ruby scripts. It’s an image processing
script that converts [sometimes thousands] of images and then HTTPs on
to archival servers. I continue to get a “permission denied” error on
one out of many files.

Why not implementing something like the following to salvage your
processing, document (LOG) the problem and deal with it latter:


success = ProdOrca.sendPNG pngfile
if success == true then
ftpfile = File.new(filesuccess, “w”)
ftp.putbinaryfile(filesuccess)
ftpfile.close
File.open(“E:/logs/StatusReports/InfoConFiles.log”, …
else
ftpfile = File.new(fileerror, “w”)
ftp.putbinaryfile(fileerror)
ftpfile.close
File.open(“E:/logs/StatusReports/InfoConFiles.log”, …
end
####### Salvage your operation and log the problematic files ######
begin
FileUtils.rm(pngfile) <----- This is what it’s complaining about.
rescue
puts “LOG: #{File.expand_path(file)} can not be handled”
end

Guess what? That’s exactly what I did. Thanks a lot for your suggestion.
Begin/Rescue comes through for me again. I realized that FileUtils would
be full of “raises” and “exceptions,” so, a begin/rescue should work
just fine. I’m running the script now on about 1,400 files.