Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't convert an open Word with OneDrive, but can copy it #10436

Open
ZhuangQu opened this issue Dec 5, 2024 · 7 comments
Open

Can't convert an open Word with OneDrive, but can copy it #10436

ZhuangQu opened this issue Dec 5, 2024 · 7 comments
Labels

Comments

@ZhuangQu
Copy link

ZhuangQu commented Dec 5, 2024

When A.docx is open, this happens:

> pandoc A.docx
pandoc.exe: A.docx: withBinaryFile: permission denied (Permission denied)

However, we can do this:

> copy A.docx B.docx
> pandoc B.docx
<p>It's OK.</p>

It's puzzling: if you can copy it, you should be able to convert it. Both require only read permission.

Does pandoc need higher permissions than copy? If so, I have a suggestion: Let pandoc copy the target to a temp, convert the temp, and delete the temp. That would solve the issue perfectly.

@ZhuangQu ZhuangQu added the bug label Dec 5, 2024
@jgm
Copy link
Owner

jgm commented Dec 5, 2024

Pandoc shouldn't need higher permissions than copy. Not sure what is going on here, because the error message is not very informative.

What are the permissions on A.docx? (I assume you're on Windows; I don't know anything about how permissions work on Windows.)

Have you tried changing the permissions to see if it makes a difference for pandoc?

@ZhuangQu
Copy link
Author

ZhuangQu commented Dec 5, 2024

My OS version is Windows 11 23H2 and pandoc version is 3.5. The permission of A.docx is default (unchanged since creation). I did more experiments and found that the issue occurred while OneDrive running. Would you consider my suggestion? This will make pandoc compatible with OneDrive.

@jgm
Copy link
Owner

jgm commented Dec 5, 2024

I really can't help until the issue is more precisely diagnosed.
Is the file in question on a cloud drive?

@ZhuangQu
Copy link
Author

ZhuangQu commented Dec 5, 2024

I really can't help until the issue is more precisely diagnosed. Is the file in question on a cloud drive?

After reading your reply, I did another experiment and confirm your doubts. This issue requires three conditions:
(1) A.docx is open.
(2) OneDrive is running.
(3) A.docx is in the OneDrive folder.

@jgm
Copy link
Owner

jgm commented Dec 5, 2024

I don't think I can help further, because I don't have a Windows/OneDrive setup to test on.

@ZhuangQu
Copy link
Author

ZhuangQu commented Dec 5, 2024

Are there other developers/contributors can help?

@ZhuangQu ZhuangQu changed the title Can't convert open Word, but can copy Can't convert an open Word with OneDrive, but can copy it Dec 5, 2024
@ZhuangQu
Copy link
Author

ZhuangQu commented Dec 5, 2024

Pandoc shouldn't need higher permissions than copy.

I wonder if pandoc will lock the file when reading it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants