It is possible that your $fullfilename does not exist. You are trying to open ./dpi.2006-12-12+/iip8061211. If that does not exist, enscript will try to processess stdin which may not be a tty on your process. Also ensure that your output file can be created.