This is a read-only archive of lispforum.com. The forum was locked to new users and posts and is preserved here as static HTML from a database snapshot taken on 2019-09-07.

delete-file -> file-error

16 posts · 5191 views

Hello,

I am running lisp on Allegro CL Express Edition and am getting this error when I try to delete this file. Note: the file does exist and I am running this on Windows.
CG-USER(12): (delete-file "C:/acl82express/output.txt")

Error: deleting "C:\\acl82express\\output.txt" resulted in error (code
       13): Permission denied.
[condition type: FILE-ERROR]
I am getting the same error with rename-file. Any idea why this might be happening? I've tried it with a pathname too (#p), but both the pathname and namestrings are giving me this error :cry:

Thanks!

Re: delete-file -> file-error

The error message tells you what the error is: permission denied. Windows has had file permissions for a long time now. Unfortunately I don't really know in detail how that works there, but presumably the file was created by a different user or is read only. Check file properties.

Re: delete-file -> file-error

Gah, I was hoping you weren't going to say that. I've gone into the file and change it's permissions -- allowing everything. Also went to the directory itself and changed it's permissions -- again allowing everything. Yet I am still getting this error. Is there perhaps a better way to delete files/rename files on Windows using CL?

Thanks!

Re: delete-file -> file-error

Are you sure it is not set read only? I believe the attribute is set in a different tab that permissions as such.

I don't think there is a better way. Unless you want to directly call Windows API, but presumably it would tell you the same thing.

Re: delete-file -> file-error

Well I have written to it. I just made a simple .txt file, wrote some text to it, and now I am trying to either delete or rename it. The read-only check box has not been checked and has read,write and modify permissions.

Hmm, I guess I blame windows :roll:

Re: delete-file -> file-error

Try deleting the file if it is e.g on your desktop.
Don't take the FUN out of DEFUN !

Re: delete-file -> file-error

Actually, looking back at it...I have found that the directory is set to read-only. However, any attempt to change this is not working. I uncheck it and when I come back it has been checked again. I did of course hit apply and ok.

Re: delete-file -> file-error

I also have such permissions, but you do not seem to be bound by any "windows chains" outside the Program Files directory, etc.
Don't take the FUN out of DEFUN !

Re: delete-file -> file-error

Indecipherable wrote:I also have such permissions, but you do not seem to be bound by any "windows chains" outside the Program Files directory, etc.

Sorry, this is the first time I've really tried working with files. Are you saying there is a way to stop this from happening and allow me to look into the contents of this directory and modify/delete files?

Re: delete-file -> file-error

Now I am not so sure... What is the default directory that you are in when the terminal loads? Try typing (cd)
Don't take the FUN out of DEFUN !

Re: delete-file -> file-error

It is vaguely possible that this is somehow fault of Allegro Express Edition. You could try CCL which has a good Windows implementation.

Re: delete-file -> file-error

Well I am running it through Allegro CL, so the default-directory is
CG-USER(3): *default-pathname-defaults*
#P"C:\\acl82express\\"

Yeah I was thinking maybe it is because of ACL. That directory is the one that is not allowing me to modify the contents of it. That seems awfully limited though.

Re: delete-file -> file-error

[
2]> *default-pathname-defaults*
#P"C:"
[3]> (cd)
#P"C:\\Program Files\\clisp-2.49\\"
And I also can't change the "read-only" attribute of the directory, but I can delete files though. I'm using Clisp.
Don't take the FUN out of DEFUN !

Re: delete-file -> file-error

Okay, well if you're using Clisp and you can delete that makes me think it's something to do with acl's directory. Guess I'll have to just put these files somewhere else or use Clisp.

Thanks!

Re: delete-file -> file-error

Indecipherable wrote:[
2]> *default-pathname-defaults*
#P"C:"
[3]> (cd)
#P"C:\\Program Files\\clisp-2.49\\"
And I also can't change the "read-only" attribute of the directory, but I can delete files though. I'm using Clisp.

I tried with clisp and I am nearly there! Though now I am getting a different error:
(delete-file "C:/Program Files/clisp-2.49/output.txt")

 DELETE-FILE: Cannot delete file
 #P"C:\\Program Files\\clisp-2.49\\output.txt" since there is a file
 stream open to it
How could there be a stream open to it?

Re: delete-file -> file-error

After 2 hours of trying I've figured it out, thanks for the help guys:


I still have not found out the issue with ACL, but I think it's safe to say for some odd reason ACL does not want you to put files in its home directory. So bottom line, don't save it there.

As for the above issue, I guess the stream open is the actual file I made and is somehow connected to clisp while it is open. When I close out and come back in it lets me do this. Still seems limited and I'm sure there is a better way. But I assume if I save files somewhere other than these two spots I would get it all to work just fine.


EDIT: Sorry, I'm really not on it today. It is saying a stream is connected to it because I have not closed the file. Also, since I can't seem to do stuff with it in ACl, I could easily just change the *default-pathname-defaults* to be something else so I can easily get to it, and not have to put up with all the excess typing. Thanks again!