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

[WinError 5] Access Denied in Postcompiler #269

Open
electrovoyage opened this issue Jun 10, 2024 · 3 comments
Open

[WinError 5] Access Denied in Postcompiler #269

electrovoyage opened this issue Jun 10, 2024 · 3 comments

Comments

@electrovoyage
Copy link
Contributor

[E] logger.except_handler(): Uncaught Exception:
Traceback (most recent call last):
  File "hammeraddons\postcompiler.py", line 315, in <module>
  File "trio\_core\_run.py", line 2010, in run
  File "hammeraddons\postcompiler.py", line 303, in main
  File "srctools\bsp.py", line 1455, in save
  File "srctools\__init__.py", line 534, in __exit__
PermissionError: [WinError 5] Access denied: 'd:\\steam\\steamapps\\common\\portal 2\\sdk_content\\maps\\tmp_3' -> 'd:\\steam\\steamapps\\common\\portal 2\\sdk_content\\maps\\zoo_under_walkway.bsp'

When running the postcompiler, I sometimes get this message, and sometimes I don't. This always causes the postcompiler to crash/quit. I have no idea why it's getting denied permission.
Perhaps implement a system where it basically retries this a couple times in case of an exception? If it's still unsuccessful, the exception can be thrown anyway.

@TeamSpen210
Copy link
Owner

That could be because you have the BSP open in another program, like the game - if open it can't be written to, so it gets an access denied error. I have the postcompiler write the new BSP to a temp file then rename it over the original, that way it's more difficult to get a partially-written BSP.

@electrovoyage
Copy link
Contributor Author

The file is open in the game. However, the game is running a BSP from portal2/maps/ and the postcompiler is getting denied access to a map in sdk_content/maps/. The compile chain ends with a copy command, which means the file in portal2/maps/ isn't a symlink to the one in sdk_content/maps/, in which case I could see how it would be getting denied access.

@electrovoyage electrovoyage changed the title [WinError 5] Permission Denied in Postcompiler [WinError 5] Access Denied in Postcompiler Jun 12, 2024
@electrovoyage
Copy link
Contributor Author

Also, this error results in dozens of temp files piling up and not being deleted.

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

No branches or pull requests

2 participants