Error 48: File or folder does not exist.

Discussion of actual or possible Photoshop Scripting Bugs, Anomalies and Documentation Errors

Moderators: Tom, Kukurykus

digitaldork

Error 48: File or folder does not exist.

Post by digitaldork »

Photoshop is report the following error on launch of a script (CS2) from the File->Scripts menu. "Error 48: File or folder does not exist." It then lists an included script file that (#include "ScriptUtils.jsh") which is in the same directory and the main script file that is launched.

I have not run into this issue during development or general use of my scripts but others who use my scripts have reported this issue.

Has anyone seen this or have any ideas. I didn't have any luck searching the Adobe forums.

Thanks.
Andrew

Error 48: File or folder does not exist.

Post by Andrew »

I think I have seen something similar when either the included script has had problems in it or where something is going wrong with the script path name (can't remember enough to be much help).

Andrew
obiwan1129

Error 48: File or folder does not exist.

Post by obiwan1129 »

Hey guys I am having a similar problem, with my include file. I don't know if anyone figured it out. I am running these scripts on a Windows XP Pro box. It works here on my end and with several users. I just had someone call in that is getting the same error message.

We did some troubleshooting and found that the users account on their network does not work and gives them the Error 48 : File or Folder does not exist error. Now on the same machine, if he logs in locally with another user, it works.

So there is most likely a user security setting of some sort that is causing a problem. They are looking through their network security settings right now but I didn't know if anyone else had figured it out already.

Any input would be greatly appreciated.

John
digitaldork

Error 48: File or folder does not exist.

Post by digitaldork »

I went the fail safe route and wrote a ruby script that parses my main jsx file for includes and replaces them with the full source of the included script. This way I will never have this issue again. During development I use the includes and it always works for me but includes don't always work for my users.

Code: Select all###############################################################################
# parse file for includes and replace with real files data
# this is lame, but PS includes are not working all the time???
# look for -> //@include "json.jsh"
# returns arrary of included file paths
def ReplaceIncludes(file)
    includes = Array.new
   File.open(file, 'r+') do |f|   
      out = ""
      f.each do |line|
         matchdata = line.match(/\/\/[\@|\#]include\s+\"(.+?)\"/)
         if matchdata and matchdata[1]
            # read in include file
            incfile = Pathname.new(file).dirname + matchdata[1]
            if incfile.file?
               puts "\t" + matchdata[1]
               File.open(incfile) { |inf| out << inf.read() }
               includes << incfile
            end
         else
            out << line
         end
      end
      f.pos = 0                     
      f.print out
      f.truncate(f.pos)             
   end
   
   includes
end
janus

Error 48: File or folder does not exist.

Post by janus »

Looks like this thread is fairly old, but it's probably still worth posting what I've found on this subject. So far, I've only confirmed this behavior in Photoshop CS 2 for Windows, though it may also exist in CS 3. Currently, I have no means to check whether this is also an issue on Macs.

Here is how to replicate the problem with broken link files in the scripting environment:
- Make sure Photoshop is not already running.
- Launch Photoshop by double-clicking a file that is associated with the app. Also, the file used to launch Photoshop must not be on your C: drive, it only appears to happen when the startup document is not on the drive that Photoshop is installed on.
- Now try to run any script that uses linked files. You should receive the "Error 48: File or folder does not exist" message.

It seems to be a bug in the implementation of Photoshop's command-line arguments, but it is difficult to know for sure.

A workaround that I've used is to run an event script at startup to: 1) check to see if a document has been opened (Photoshop only allows one doc to open at launch), 2) determine the drive letter of that document, and 3) compare that drive letter to the drive letter of the user's "Documents and Settings" folder. (It would probably be more accurate to find Photoshop's install path rather than the "Docs and Settings" folder, but the startup script is already working for all of our users.) The script then warns the user to restart Photoshop if s/he is planning to use any of our custom scripts.
Mike Hale

Error 48: File or folder does not exist.

Post by Mike Hale »

Another workaround that avoids the Photoshop restart is to place your include files in a folder under the home directory. For example

Code: Select all#include "~/Application Data/Adobe/myLib/alerts.jsx"

That creates an absolute path that Photoshop can always follow.

Mike