Print Error - Cannot open file: permission denied.
5 views (last 30 days)
Show older comments
Hello all,
I'm getting an error sporadically when I'm running my program. I generate multiple plots and save them using a command like:
print('-dpsc2','-r144', [OutputString '_Sinkage_and_Pitch_VS_Ship_Speed'])
Sometime it runs fine, other times I can't get the first plots saved, and other times it stops after a few plots. I just simply run the program again and usually after 2~3 attempts, I don't get an error and it runs just fine. I'm wondering if anyone would have any insight as to why I'm getting this error.
Error:
??? Error using ==> print>LocalPrint at 286 .\RES_A_Total_Resistance_and_Effective_Power_VS_Ship_Speed.ps: Cannot open file: permission denied.
Error in ==> print at 228 LocalPrint(pj);
Thanks.
1 Comment
Daniel Shub
on 17 Oct 2011
Are you printing to a network or external storage drive? Do you have full permissions to the directory? What OS are you using?
Answers (1)
Jason Ross
on 19 Oct 2011
I would look into Daniel's permission question, and also check the amount of:
- Temp / swap space on your machine
- Disk space on your machine
- Disk space on the network resource (if you are saving to a network resource)
4 Comments
Daniel Shub
on 15 Nov 2011
@Peter, You might be better off posting this as a new question. As for an answer, what are all the ~ doing in the path? I think on Windows the maximum path length + filename length is 255, how long is your path?
Peter
on 15 Nov 2011
@Image Analyst: the file name 'myfilename' does change on each iteration, but the only thing that changes is a few characters (i.e., the path, basic file name format and length, and file extension all remain the same). The post-script file is (AFAIK) a temp file created by the built-in MATLAB function 'print.m' or one of its subfunctions - something I don't have control over. I can't find any similarly-named file on my machine. Note that I'm using the 'recycle off' function at the start of my code, because before I did that similar temporary post-script files were being sent to my recycle bin rather than just being deleted after the .pdf file was created.
@Daniel: I'll try posting as an original question. Per the path issue, I was just trying to eliminate folder names so that just the filename (and not the path) on my computer was visible - sorry if it's not correct computer-ese. Both of those file paths are fine in terms of length; the one is simply where MATLAB installed the built-in 'print.m' file and the other is just a temp folder created by Windows XP (both something I don't have control over).
See Also
Categories
Find more on Startup and Shutdown in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!