I’ve been spending hours trying to get this done, but still haven’t found any solution:
I have created a Phython script, “test.py” in Blender:
from Blender import Window
I have set the sensor for my camera to cause a controller to run “test.py” on pressing the “W” key.
If I run the game within the Blender GUI, everything works fine, the two prints you can see in the script are made to the Python console.
However, once I save the game as runtime, the console prints an error of “ImportError: No module named Blender”. For some strange reason, the “GameLogic.getCurrentController()” gets printed even by the EXE, while the “Window.GetScreenSize()” doesn’t, since the Blender.Window module could not be imported for the latter.
How can this be? I was hoping that Blender would create an EXE smart enough to hold ALL the necessary Python API modules, the Blender Game Logic API, AND the Blender API for python?
I need to be able to read the current size of the display window.
I am using Python 2.6, Blender 2.49b (also tried the 2.49), have also copied all the necessary DLLs into the EXE directory, registered the test.py in the TEXT node of the .blend file database…
What else could be the problem? Can the Blender Pyhton API be used in an Runtime EXE at all?
Thanks in advance.