Skip to content

Fix crazy [Access is denied] error on TC run on Windows OS#145

Merged
rocky merged 2 commits intorocky:issue_138from
greenozon:issue_138
Aug 17, 2024
Merged

Fix crazy [Access is denied] error on TC run on Windows OS#145
rocky merged 2 commits intorocky:issue_138from
greenozon:issue_138

Conversation

@greenozon
Copy link
Contributor

this PR fixes the issue seen in #138 under Windows:

Traceback (most recent call last):
  File "c:\Dev\python\python-xdis-orig\test\test_pyenvlib.py", line 266, in <module>
    do_tests(
  File "c:\Dev\python\python-xdis-orig\test\test_pyenvlib.py", line 185, in do_tests
    check_bc_file = check_object_path(bc_file)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\user\AppData\Local\Programs\Python\Python312\Lib\site-packages\xdis\load.py", line 89, in check_object_path
    py_compile.compile(spath, cfile=path)
  File "C:\Users\user\AppData\Local\Programs\Python\Python312\Lib\py_compile.py", line 172, in compile
    importlib._bootstrap_external._write_atomic(cfile, bytecode, mode)
  File "<frozen importlib._bootstrap_external>", line 208, in _write_atomic
PermissionError: [WinError 5] Access is denied: 'C:\\Users\\user\\AppData\\Local\\Temp\\06_frozenset-m0zxlh9_.pyc.20330544' -> 'C:\\Users\\user\\AppData\\Local\\Temp\\06_frozenset-m0zxlh9_.pyc'

come into my head after reading some Python issues/conversations, eg:
https://bugs.python.org/issue46003

@rocky
Copy link
Owner

rocky commented Aug 17, 2024

Although a context manager is preferrable here, given we haven't figured out what the access violation on Windows is, I guess we have to go with this.

@rocky rocky merged commit 18c0ffb into rocky:issue_138 Aug 17, 2024
@greenozon
Copy link
Contributor Author

@rocky thanks!

there is one question left: do you know why do we have those temp files left in the Temp dir? (WIndows)
(after running make check)

image

@rocky
Copy link
Owner

rocky commented Aug 17, 2024

If there is a failure in testing this is useful to keep around. However if there is no failure, then these should be removed.

Probably if we used a context manager properly this would be handled more naturally.

By the way, what is your motivation behind all of this recent activity for xdis? If you are using this in conjunction with doing some other project, what is that other project?

Lastly, I'll mention that there was some cleanup to the the load.py and the last set of changes. You might want to pick those up.

@greenozon
Copy link
Contributor Author

Well, the motivation is many-fold

  1. make Pythonistas life better under Windows :)
    despite I use Linux as well (at least in my professinal business time)
  2. more focused - I'd say I love to spend some time in the open source communities, it's kind of hobby or so, it's a feeling when you tink about what do you do on the planet Earth, what would you leave after yourself finally...
  3. from some time in the past I started to use xdis as a reference tool that helps in another actiivity - mainly pycdas/pycdc

Thank you very much, I'm very pleased to receive attention from the much more mature and experienced professional which you are indeed

PS, yeah, just explored the last set of changes to the load.py module, looks great!

@rocky
Copy link
Owner

rocky commented Aug 17, 2024

Well, the motivation is many-fold

  1. make Pythonistas life better under Windows :)

Great!

  1. more focused - I'd say I love to spend some time in the open source communities, ...

Great!

  1. from some time in the past I started to use xdis as a reference tool that helps in another actiivity - mainly pycdas/pycdc

Thank you very much, I'm very pleased to receive attention from the much more mature and experienced professional which you are indeed

That is good too. I notice however that you have starred neither xdis nor pycdc that you are requesting and receiving attention from. If you want to go further, there is also a sponsor button.

@greenozon
Copy link
Contributor Author

pardon me, fixed :)

image

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments