RepeaterCreeper
RepeaterCreeper

Reputation: 342

Pywin32 is not found when I create a file

When I execute it manually through Python IDLE 3.4 32Bit the import and everything works just as expected. But when I try and create a file and then write the import and every other code, for some ODD reason it cannot find the filepath. Is it because I'm putting the file in my desktop?

import win32com.client as comclt

wsh = comclt.Dispatch("WScript.Shell")
wsh.AppActivate("Command Prompt")
wsh.SendKeys("Hello")

Extra Information

Python Version: 3.4
Pywin32 Version: pywin32-219.win32-py3.4

System Type: 32 Bit

ERROR Message:

Traceback (most recent call last):
File "C:/Users/RepeaterCreeper/Desktop/tested.py", line 1, in <module>
import win32com.client as comclt
File "C:\Python34\lib\site-packages\win32com\__init__.py", line 5, in <module>
import win32api, sys, os
ImportError: DLL load failed: The specified module could not be found.

If you need more information do let me know down in the comments below and I will be sure to add it as soon as I see your comment.

Upvotes: 2

Views: 875

Answers (1)

kbang
kbang

Reputation: 704

Its most likely an issue with python not being in your environment.

Check your PATH

Start -> Control Panel -> System -> Advanced.
Click on Environment Variables, under System Variables, find PATH, and click on it.
Add python directory to path ,end it with ;

Upvotes: 1

Related Questions