-
-
Notifications
You must be signed in to change notification settings - Fork 97
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
Any plan to support WSL? #577
Comments
Hi, @ajkessel This package functionalities depends on Python being the Windows version. This package cannot be executed with the Linux version of Python, including that operates on WSL. Cygwin performs API translation to utilize the Windows kernel, whereas WSL uses the Linux kernel itself. Although, to my knowledge, the Python available in Cygwin is the Windows version. This package does not cause an error upon installation itself to platforms other than Windows, as it may be specified as a dependency for cross-platform compatible software. There was a report in issue #157 that installing this package in a Linux environment caused an error, but this has been corrected since I have come to think that the content written in the "Frequently Asked Questions" is insufficient. It seems necessary to clearly state that "while this package can be installed on other platforms, it is only executable with the Windows version of Python" after the note for cross-platform. Have you actually run comtypes from Cygwin? |
cygwin also fails
I think there are probably other users like me (not especially sophisticated) who think of WSL applications as having some "Windows-like" properties even if it is, in fact, a Linux distribution. I did some poking around and couldn't figure out if the COM interface is actually exposed to WSL, but it is possible, e.g., to run Windows binaries from the command-line in WSL and it works seamlessly with native WSL components. |
I would like you to show us what Perhaps this issue should be escalated to the cpython community that implements |
I realized that there might have been some mistakes in the knowledge I had. Since the Cygwin version of Python (even though the source code is common) is not an official build of CPython, escalating Cygwin's circumstances to the CPython community might be inappropriate. Since Cygwin can execute Windows exe files, by running the Please try it in your environment and share it with this community. |
I'll see what I can figure out using the Windows python.exe from within WSL/cygwin. |
OK, this does what I want, and works in WSL and cygwin. Comtypes (and the uiautomation library) work fine when python is invoked this way. I created a script we'll call
I'm also using the portable version of Windows Python, hence the c:\apps\python path rather than wherever the standard install package puts it. |
I'm glad you were able to achieve what you wanted without changing the source code of this project. In summary:
@ajkessel |
Unless I'm not looking in the right place, the FAQ doesn't mention WSL or Cygwin -- do you want to update it to clarify that even though both of those are running on a Windows host, they don't support comtypes, however, the user can still leverage comtypes from WSL/Cygwin by invoking Windows Python from within those environments? |
Indeed, it is important to inform that there is a chance to run However, I am concerned that mentioning only WSL or Cygwin will lead to endless questions like “What about foo platform?”. Therefore, I will abstract it a bit more and state in the FAQ: What do you think? |
To my knowledge, WSL and Cygwin are the only "Windows-like" environments whose Python implementations don't support comtypes, so I would still suggest calling them out. The user is in Windows, so, like me, may expect a Python module that relies on a Windows API would work. So I would still suggest calling out WSL and Cygwin. Down the road, I do suspect there is some way to get comtypes to work "natively" in WSL or Cygwin, since they are both running on a Windows host. I'll do some more poking around to see if I can find any other WSL or Cygwin process that interacts with COM. For example, this suggests it shouldn't be too heavy a lift in Cygwin. |
I would like to leave that investigation to you. |
Understood. My suggestion for now is just that you mention WSL/Cygwin on the FAQ since those are the only common environments that run on a Windows box where this library won't work. |
Is there any plan/ability to support WSL? The module installs fine from Python in WSL but complains
ImportError: cannot import name 'COMError' from '_ctypes'
on import.Same issue in Cygwin which presumably has even more direct access to COM?
The text was updated successfully, but these errors were encountered: