I am using ghostscript in my web deployed app. The code is as follows:
cmd = “gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=Outputfile.pdf” + filestring
sh = new shell
sh.execute(cmd)
“filestring” is a string containing the list of files I am merging.
The command works, but the problem I am experiencing is when I use Filezilla to download the file to my local computer I get the following:
Error: /web/Toolbar-Dev/Documents/Outputfile.pdf: open for read: permission denied
Error: File transfer failed
It is my understanding that the -dBATCH command should cause the program to exit after processing the files contained in “filestring”. Eventually after for whatever reason the server lets the Outputfile.pdf be downloaded the file is without errors. Sometimes it is just a matter of several hours or the next day.
Any ideas on how to modify the command line invoking ghostscript to make sure the file closes, or perhaps alternatively, some method using xojo or linux to do the same?
Regards.
You may try to copy the file, and download the copy.
Michael:
I tried your suggestion. I now have two files I cant’ download.
Thanks.
[quote=203544:@Stuart Travis]Michael:
I tried your suggestion. I now have two files I cant’ download.[/quote]
Ouch. And very strange… Are you using the same shell or another ? BTW, I suppose you close the shell into which you call GhostScript ? As a child process, it should quit immediately.
The copy should not be locked. How did you copy it ? Through shell with cp or with Folderitem.CopyFileTo(FolderItem) ?
Maybe CP keeps the same permissions, but CopyFileTo should not.
Otherwise, you could still create a new file in Xojo and copy through BinaryStream. Hopefully the file will not be locked for read.
Unless someone else has a tip for GhostScript.
Michael:
I neglected to close the shell (oop!), but after doing so
it made no difference.
I copied through the shell with cp.
I will try copyfileto
Thanks
Is this app running on Xojo Cloud?
He is mentioning FileZilla. Is Xojo Cloud accessible that way ?
Greg, this app is running on Xojo Cloud.
Michel, Xojo Cloud is accessible through Fillezilla. I use it to upload files.
[quote=203726:@Stuart Travis]Greg, this app is running on Xojo Cloud.
Michel, Xojo Cloud is accessible through Fillezilla. I use it to upload files.[/quote]
Then you definitely want to talk to Greg.
Have you tried CopyFileTo, or recreating it with BinaryStream ?
[quote=203726:@Stuart Travis]Greg, this app is running on Xojo Cloud.
Michel, Xojo Cloud is accessible through Fillezilla. I use it to upload files.[/quote]
Ok. I suspect this is more of a permissions issue than anything else, as in SELinux isn’t granting permission. I’ll have to look at your logs to clear this up.
Greg:
Which logs would you need to see?
Try appending a CHMOD command to your ghostscript command.
cmd = “gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=Outputfile.pdf” + filestring + " | chmod 777 Outputfile.pdf" + filestring
Phillip:
I just tried it
and it did not work. The permissions were changed, but the file would not download.
Thanks.
A few additional thoughts. I do not have any server admin experience, but it would seem logical that restarting the server would shut down any processes that are keeping the file ‘open’.
Restarting the server does not do any good. It seems only after I have created at least a couple of more files (they all have different names) are they able to be downloaded.
I have tried saving multiple copies of the same file to see if that will ‘release’ the file I am interested in. This too does not work.
What will happen if you copy the file to a different location?
I wonder if your files beneath that folder ( /web/Toolbar-Dev/Documents) have a permission issue.
[quote=203835:@Stuart Travis]Greg:
Which logs would you need to see?[/quote]
The SELinux logs. I’ll look at them when I get a moment.
@Stuart Travis Please check and see if it’s working now.
Greg:
That did the trick. What a deal! For once it wasn’t my problem! Thanks a lot Greg, and everybody else who took a whack at it.