haghish / markdoc

A literate programming package for Stata which develops dynamic documents, slides, and help files in various formats
http://haghish.com/markdoc
87 stars 30 forks source link

file cannot be modified or erased; likely cause is read-only directory or file r(608) #21

Closed alexmitrani closed 5 years ago

alexmitrani commented 7 years ago

Dear Dr. Haghish

I've just started using markdoc, which looks very useful. Unfortunately, I have had persistent instances of the following error message:

"It seems your operating system does not allow MarkDoc to replace your script file. This probably means that you are a Microsoft Windows user. MarkDoc created \Users\amitrani\Desktop\markdoc\xposed_2.ado instead, so you can work further on this file or replace it yourself. The original error was: "file C:\Users\amitrani\Desktop\markdoc\xposed.ado cannot be modified or erased; likely cause is read-only directory or file {help r(608)}" file C:\Users\amitrani\Desktop\markdoc\xposed.ado cannot be modified or erased; likely cause is read-only directory or file r(608)"

I am using Windows 7 with Stata 13 and while I don't have administrator privileges, i do have full read / write / delete permissions and I have hardly ever had difficulties of this kind before.

I did some testing in Stata but outside of markdoc and discovered that I could not reproduce the error message by copying and overwriting files replacing other files from within Stata.

copy "C:\Users\amitrani\Desktop\markdoc\xposed.ado" "C:\Users\amitrani\Desktop\markdoc\xposed_1.ado" erase "C:\Users\amitrani\Desktop\markdoc\xposed.ado" copy "C:\Users\amitrani\Desktop\markdoc\xposed_1.ado"

I could only get the same error message by trying to copy a file replacing itself: copy xposed.ado xposed.ado, replace file C:\Users\amitrani\Desktop\markdoc\xposed.ado cannot be modified or erased; likely cause is read-only directory or file r(608);

Therefore, perhaps a little re-writing of the file replace operations could solve this problem without requiring users to have admin privileges? Or am I misunderstanding the nature of the problem? I hope my comments are useful, in the meantime I will try to use markdoc with the presently available funcionality.

My underlying concern is that I work on a corporate network and I know the IT department won't give me admin privileges.

Kind regards

Alex Mitrani

haghish commented 5 years ago

Did you try a different working directory? Sometimes it solves the problem. This error is one of the "Windows specific" errors that occurs between Stata and Windows (and really it has nothing to do with markdoc). Please contact Stata Corp and I'm sure they will be very helpful.