-
Notifications
You must be signed in to change notification settings - Fork 843
Description
Hi,
I need to install PyWin32 for an application that includes a framework for writing plugins in Python (Cinema 4D, specifically; henceforth C4D), that is, has a Python interpreter shipped with it. I've had no troubles installing many other modules under this framework (e.g., SQLAlchemy), but PyWin32 is giving me fits.
When I install Python under C:\Python27 and run either the executable installer for PyWin32 or "Scripts\pip install pywin32", I can then "import win32security" with that python interpreter without trouble. Thus, in principle, PyWin32 has no problems functioning correctly on my machine.
However, when I copy the files installed under site-packages to the site-packages directory of C4D, I always get the DLL load failed error. I've ensured that Windows' PATH variable includes the pywin32_system32 directory, and even tried copying all the DLLs from the PyWin32 directories under site-packages to both \Windows\System32 and \Windows\SysWOW64, but the problem persists. I've even tried copying the entire site-packages directory to a different location and the used "import site" with the appropriate calls so that the .pth file is used --- which I've checked to ensure that it is indeed being used and used correctly (i.e., win32, win32\lib, and pythonwin are added to sys.path and at the OS level pywin32_system32 is added to the PATH) --- but some DLL is still not loading. I've also tried installing pip under C4D's python and then running "pip install pywin32", which installs fine and without error, but still some DLL is not loading. Finally, I've made these attempts both with and without python installed in C:\Python27, both with and without PyWin32 installed from the executable installer, and all the possible combinations of these.
So, I'm at a bit of a loss. If anyone has any ideas, I'd be most grateful to hear them.
All I really need is win32security so that I can temporarily use Impersonation, as for security reasons part of my Python plugin must copy some files to a network share as a user other than the logged-in user. If there are other ways to accomplish this, with or without PyWin32, I'd also be glad to hear about them.
If I could determine which DLL is not loading, that of course would be helpful. I do not understand at all why the error message does not clarify which DLL cannot load, but my understanding is that this failure to report better information is rooted in Windows itself rather than Python or PyWin32. I've of course considered using some utility for determining which DLLs are not loading, but I'm not sure how I would use such a tool when Python itself is running within C4D. Again, any pointers or suggestions would be most welcome.
Thanks,
Doug