Reading data using runtime executable.

I am using blender to read in data from an external data file once I start the game engine within blender. This works fine as long as I am running the game engine through blender. When I create a run-time executable, It seems like this new executable will no longer read the data file. The executable, blend file, and data file are all in the same directory. The python script used to load the data into an array is setup to find the file in the local directory.

I am using 2.34 and running on a Windows XP machine.

Does anyone know why I can’t see the data using the .exe?

Thanks

strange… anyone know if exe’s are sandboxed?

Try using “Save Dynamic Runtime” instead of “Save Runtime”.

I get “ERROR: Unable to make aruntime: Unable to find runtime.” Anyone know how to fix this?

Thanks

would you mind posting your python code in which you get the data file loaded. I ask this because I thought that one could not use the regular blender python fuctions from the game engine. In other words you could not do something like:

import blender
from blender import *

get.selected()[0]

I would be extremely useful if one could access blender’s rending and drawing functions within the game engine.

I get “ERROR: Unable to make aruntime: Unable to find runtime.” Anyone know how to fix this?

don’t you use 2.34? If you want save dynamic runtime you schould use 2.25.
and if you save dynamic you also schould append python20.dll & fmod.dll to the same directory.

jm

I tried to use Dynamic runtime because someone sugested it (see above) since I could not read data from outside the .exe (see original question).

My python script for reading information goes something like this:

import GameLogic
from array import *
import os
FileCont = GameLogic.getCurrentController()
ownFiles=FileCont.getOwner

GameLogc.EngineObjects={}

FileToOpen=".\CSSANIMATION.bdat" #where .bdat is a binary file

try:
FileHandler=open(FileToOpen,“rb”
binfilestat=os.stat(FileToOpen)

TrueNumFloats=binfilestat[6]/4
BinArray=array('f')
BinArray.fromfile(FileHandler,TruNumOfFloats)

.
.
.

I would store the data in the GameLogc.EngineObjects for objects to use.

I would then get the data that was read into the array and apply it to the objects. Again…this works in the gameengine when running through blender and not after creating a runtime exe (Save Runtime…).

you schould not have any print in code.

look at http://www.elysiun.com/forum/viewtopic.php?t=21585&highlight=exe+jm

jm

Just replying on jm’s last comment…I took the print statements out, and that did the trick!

Thanks
kingjames

Hello

I guess that your Blender version don’t have the Player file “inside”

Download one of the “new” versions in the Testing Builds forum

Bye

If you want to print from an exe, you can do this:


import sys
f = open("log.txt","w")
sys.stdout = f   #print messages will be logged
sys.stderr = f   #error messages will be logged