-
Notifications
You must be signed in to change notification settings - Fork 809
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
pypiwin32: does not check existence of pywin32_system32 in path before setting #721
Comments
Are there any plans to fix this bug? |
I'd take a PR |
On the So instead we put the
.. your guidance would be welcome. In all honesty though I do not think I will have time to look at fixing this 'properly'. The changes we do for this in Hopefully this can be useful for someone motivated enough to fix this properly? |
Unfortunately, that "actual" fix would need to be done for every single .pyd in pywin32, as they all have that exact same issue.
I suspect that means you will still have the same issue when trying to use the win32com package. Does everything work if you "import pywintypes" before "import win32api"? |
Not sure. Our fix is good enough for us and I'm unlikely to get round to this anytime soon. I just copied all the DLLs (both) to where they'll naturally be found. I'd remove this |
I guess I'm suggesting moving the DLLs and changing where |
That change was made in build 222 (and it's actually pywintypes.py that does the searching - _win32sysloader only does the loading), so you may find it works now. |
Fixed by 71afa71 on Python >= 3.8 |
on pypi, the packages have a line in the pywin32.pth file:
import os;os.environ["PATH"]+=(';'+os.path.join(sitedir,"pywin32_system32"))
however, when you have an application that reloads the modules without exiting the python process, this will cause the path to ultimately over-run the os.environ['PATH'] buffer.
The fix would be to change that line with:
import os;os.environ["PATH"]+=(';'+os.path.join(sitedir,"pywin32_system32")) if "pywin32_system32" not in os.environ["PATH"] else ''
ultimately when the buffer over-runs, all types of bad things happen to the running application.
Reported by: dharpe12
Original Ticket: pywin32/bugs/721
The text was updated successfully, but these errors were encountered: