Kyle
Kyle

Reputation: 2379

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.

Upvotes: 0

Views: 403

Answers (1)

Kyle
Kyle

Reputation: 2379

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.

Upvotes: 2

Related Questions