Python Forum

Full Version: How to import win32api and win32con
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
So I'm trying to import win32api and win32con. So I was researching and I found that I needed pywin32 to do this. So I used pip and installed it but python still said pywin32 was an invalid module. So I'm kinda stuck. Can someone help me?

I tried this.
from PyWin32 import win32api, win32con
I also tried this
from pywin32 import win32api, win32con
Use pypiwin32 it's a newer version to get out of exe install of PyWin32 install and over to pip.
It also simply some imports.
(my_env) E:\div_code\my_env
λ pip install pypiwin32
Collecting pypiwin32
'''''
Using cached cp37m-win32.whl (8.3MB)
    100% |████████████████████████████████| 8.3MB 1.9MB/s
Installing collected packages: pywin32, pypiwin32
Successfully installed pypiwin32-223 pywin32-224

Use:
(my_env) E:\div_code\my_env
λ ptpython
>>> import win32api, win32con
# No erros

>>> win32api.DeleteFile
<built-in function DeleteFile>