简体   繁体   中英

win32api no dll error python

I've searched for answers and tried most of them but none have fixed my problem. I have a pyton script written in Python 3.4. I have import win32api. Upon execution I get:

    import win32api
ImportError: DLL load failed: The specified module could not be found.

Upon researching I found that this can happen for many reasons, not running post-install script, not installing the correct architecture, etc. I installed the amd64 version and I ran the post install script. I don't know what else to do, but I need this to work because I need to print a document from my application.

I'm running windows 8 64 bit under Pentium processor (not AMD) but it was either amd or 32 bit on the sourceforge page. I'm running python 3.4 with 64 bit installed.

The answer is so simple no one saw it. You must import pythoncom library first:

import pythoncom
import win32api
import win32print

I hope this helps someone else.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM