pip install pywin32 didn't work for me but pypiwin32 did.
No module named ’win32com’ error
No module named 'win32com'
python 3.x - ModuleNotFoundError: No module named 'win32com' - Stack Overflow
No module named win32com
Complete beginner in Python so excuse me for any terminology errors and such.
I installed pywin32 using pip install pywin32 as well as pypiwin32 in the same way, both appear in the pip list on the command prompt. However, when I try to import win32com.client (”import win32com.client as client”) in PyCharm, it gives me the following error: ”ModuleNotFoundError: No module named ’win32com’”.
Tried to Google for this error, but it seems everyone is saying that I don’t have pywin32 or pypiwin32 installed, which according to the pip list I do.
Does anyone have an idea of how I could fix this error? I’m on Windows 10 if that matters. Thanks in advance!
Start a command line with admin rights.
python -m pip install pywin32C:\Program Files\Stackless36\Scripts>python pywin32_postinstall.py -installThe pathC:\Program Files\Stackless36\should be replaced with the path at which your Python version is installed.Test (admin rights optional) using
python -c "import win32com"orpython speak.pywhere
speak.pyconsists of this text:import win32com.client speaker = win32com.client.Dispatch("SAPI.SpVoice") speaker.Speak("It works. Hoorah!")
Working fine on Python 3.6.4 Stackless 3.1b3 060516 (v3.6.4-slp:9557b2e530, Dec 21 2017, 15:23:10) [MSC v.1900 64 bit (AMD64)] on win32. Vanilla CPython hangs out here:
C:\Users\C\AppData\Local\Programs\Python\Python36-32>python.exe
Python 3.6.5 (v3.6.5:f59c0932b4, Mar 28 2018, 16:07:46) [MSC v.1900 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import win32com.client
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'win32com'
>>> exit()
C:\Users\C\AppData\Local\Programs\Python\Python36-32>python.exe -m pip install pywin32
Collecting pywin32
Cache entry deserialization failed, entry ignored
Downloading https://files.pythonhosted.org/packages/d4/2d/b927e61c4a2b0aaaab72c8cb97cf748c319c399d804293164b0c43380d5f/pywin32-223-cp36-cp36m-win32.whl (8.3MB)
100% |████████████████████████████████| 8.3MB 50kB/s
Installing collected packages: pywin32
Successfully installed pywin32-223
You are using pip version 9.0.3, however version 10.0.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
Check sys.path to make sure the directory where the module is installed is in there, otherwise you have to add it (google PYTHONPATH windows for some help with that.)
I just installed wmi and wanted to import it, but I get an error. It tells me that File "C:\Program Files (x86)\Python35-32\lib\site-packages\wmi.py", line 88, in <module> from win32com.client import GetObject, Dispatch ImportError: No module named 'win32com'
I'll just assume that there's no such library as win32com installed. pip install win32com and pip install win32api are also raising errors though, namely "Could not find a version that satisfies the requirement (win32com/win32api) (from versions: ) No matching distribution found for (win32com/win32api)
This is probably a typical newbie problem, and I'm sorry if it is. Thanks for the help :D
Beginner here. Below is my code to extract attachments from an email within a folder. Courtesy of 'coding is fun' for the main source.
Whenever i try to run the code, the error "No module named 'wind32com'" pops up.
I've ran pip install pywin32 and it confirms installation. Restarted my laptop several times and it still doesn't work. Can someone help? If there are more errors, please do share... Love you guys.
Code as below:
from pathlib import Path
import win32com.client #pip install pywin32
# Create output folder
output_dir = Path.cwd() / "Desmond"
output_dir.mkdir(parents=True, exist_ok=True)
# Connect to outlook
outlook = win32com.client.Dispatch("Outlook.Application").GetNamespace("MAPI")
# Connect to folder
inbox = outlook.Folders("desmondtest1234@gmail.com").Folders("Test")
for attachment in attachments:
attachment.SaveAsFile(target_folder / str(attachment))