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

permission denied when working with temporary file #313

Closed
sygout opened this issue Dec 1, 2021 · 1 comment · Fixed by #315
Closed

permission denied when working with temporary file #313

sygout opened this issue Dec 1, 2021 · 1 comment · Fixed by #315
Assignees
Labels
bug Something isn't working

Comments

@sygout
Copy link
Collaborator

sygout commented Dec 1, 2021

the following code creates a problem on Windows:

´´´
with tempfile.NamedTemporaryFile(suffix=".owl") as handle:
super().save(file=handle.name, format="rdfxml", **kwargs)
graph = rdflib.Graph()
graph.parse(handle.name, format="xml")
graph.serialize(destination=filename, format=format)
´´´

It is related to an issue with tempfile library. See for example discussion: https://stackoverflow.com/questions/23212435/permission-denied-to-write-to-my-temporary-file

Similar issue might be present every time ontopy tries to work with tempfile.

@sygout sygout added the bug Something isn't working label Dec 1, 2021
@sygout sygout linked a pull request Dec 1, 2021 that will close this issue
11 tasks
sygout added a commit that referenced this issue Dec 1, 2021
@sygout sygout linked a pull request Dec 1, 2021 that will close this issue
11 tasks
@jesper-friis
Copy link
Collaborator

The nice thing with the with tempfile.NamedTemporaryFile(suffix=".owl") as handle: clause is that it deletes the temporary file when leaving it. Won't adding the argument mode="w" to tempfile.NamedTemporaryFile solve the issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
3 participants