"permission denied"

P

Peter Bailey

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
 
C

Choi, Junegunn

2009/2/20 Peter Bailey said:
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.
 
L

Lars Christensen

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.
 
P

Peter Bailey

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.
 
P

Peter Bailey

Lars said:
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.
 
P

Peter Bailey

Hassan said:
Why "obviously"? Can't you just rescue that exception, log the error,
and continue (or retry, if that makes more sense)? :)

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.
 
I

Igor Pirnovar

Peter said:
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
...
 
P

Peter Bailey

Igor said:
Peter said:
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.
 
R

Roger Pack

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
 
P

Peter Bailey

Roger said:
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,756
Messages
2,569,540
Members
45,025
Latest member
KetoRushACVFitness

Latest Threads

Top