Page 1 of 1

Importing win32api

Posted: Sun Jun 25, 2017 12:00 pm
by Nettingman
Hi,
I'm trying to make a game, where one of the characters can break the 4th wall, by turning on and off the Caps Lock.

I'm trying to do this by using the win32api module, to make virtual keypresses. The problem is, I can't import the module.
I downloaded it to python 2.7, and copied the files from

C:\Python27\Lib\site-packages
to
the_question\game\python-packages

Sadly it's not working (even though, other modules do).
ImportError: No module named win32api

It's a possible issue, that this is a library, and also win32api has a .pyd extension not .py.
I tried with copying only win32api.pyd, but I got the same error.

Any idea how to solve it?

Re: Importing win32api

Posted: Sun Jun 25, 2017 12:59 pm
by PyTom
This seems like a terrible terrible idea.

But if you really want to do it, the files need to be dropped off somewhere in lib/windows-i686.

Re: Importing win32api

Posted: Wed Feb 07, 2018 4:21 pm
by storykween
I am also trying to import win32api, AKA pywin32. In this case I'm doing it to enable desktop notifications.

I copied all the files from C:\Python27\Lib\site-packages to:

game\python-packages
AND:
lib/windows-i686

In my project's init code, I use the following code to import it:

Code: Select all

init python:
      if renpy.windows:
            from win32api import *
            from win32gui import *
            from win32gui import IsIconic
            import win32con
            import sys, os
            import struct
            import win32gui
On my OWN computer, this all works fine. However, as soon as I try to build out the game and play it on a different Windows computer, I get this error:

Code: Select all

While running game code: 
     File "game/functions.rpy", line 20, in <module>   #this is the first line of import code, containing from win32api import *
ImportError: DLL Load failed: The specified module could not be found. 
Again, this only happens once I BUILD the game. Any ideas why the game isn't building with the included libraries?

Re: Importing win32api

Posted: Fri Feb 09, 2018 10:24 am
by storykween
I'm still struggling with this on a game I'm releasing soon. If anyone has any ideas, I would really appreciate the help!

Re: Importing win32api

Posted: Fri Feb 09, 2018 1:09 pm
by PyTom
Sorry, but i don't support 3rd-party compiled python modules directly. You can take a look at your two windows-i686 directories to see which DLLs are missing there.