Problems on reading dynamic data


(KingJames) #1

I have a blend file that reads data and saves it to an array for position and orientation in the real time engine via python script. Once the data is written to the array, I press g (go) and an object is propogated by each element in the array as each frame passes by.

I can make this work fine as long as I am in publisher. However, as soon as I publish the executable, data is no longer read in. I am using a hard coded link in my script, so as long as my data is in a certain directory, it should read it fine.

Any sugestions?


(mthoenes) #2

Have you tried prayer? I would like to see this when you figure it out.
Sounds very cool!


(KingJames) #3

I am able to read data…line by line in a test case setup. I think the problem may be in setting the globals. I set a global for reading the data:

GameLogic.GlobalArrayVariable=[]

I then set in a different python script:

GameLogic.position = GameLogic.GlobalArrayVariable[counter]
(counter being incremented every frame)

Finally, I move the object to own.setPosition(GameLogic.position) in another python script.

again, All works fine as long as I’m in publisher. Let me know if anyone has any suggestions.

Thanks,
KingJames


(S_W) #4

I’m not sure…, but have you tried to create a dynamic runtime?


(KingJames) #5

I tried it…It did not work :frowning:


(wiseman303) #6

Did you copy your data file to the same dirrectory as the exe?


(saluk) #7

The sandbox in the player is probably the culprit. It’s a good idea to protect files for the web plugin, but I don’t see the point in an exe.

I can’t think of a good workaround either:(

Use SW’s exe maker instead I guess.


(wiseman303) #8

The sandbox shouldn’t be a problem, I’ve done tests, and I have no problem reading data from a text file using a standalone (even a static one!)

I think the most likely problem is that the exe is not finding the data file. Check to make sure you copied the data file to the same directory that you saved the runtime in.


(saluk) #9

Well, that’s good to hear. If the “hardcoded” link is RELATIVE (that is, it finds the file from a certain directory based on where we start) then you need to make sure the file is at the right spot in filesystem. If the hardcoded link is exact, that is of the form: “c:/myblenderfiles/files/” etc, and you are sure the file is there, you need to look at what OTHER python functions you are doing that might be breaking it. Often in things, something which appears to be the cause is merely just a symptom of some other problem.

If you still can’t get it to work, put it up here so we can help debug.


(KingJames) #10

Thank’s Saluk, and also, thanks for the blend file you e-mailed me a while back to help me get this far. I know it has been a while, but you sent me a file that recorded ipo information to a file, and then dynamically re-read the data back from the text file to make an object move. I took that information, and since reading data slows the system a bit, I first read in everything into an array, and then propogate my object with that array to keep from hard-coding my data and slowing my machine down.

I wish I could e-mail you the program, but it is proprietary to my work, and the data it reads in is classified. However, I am going to try to write an unclassified version to see if I have the same symptoms. If I have repeating problems, I’ll send them to you. I can tell you that my data path is “hardcoded” and the file is there. It does work fine untill I make my exe (and place it in the same directory as the blend filel). Thanks for all of your help

KingJames


(KingJames) #11

I think I have it figured out. I had print statements in a few of my python scripts which works fine in blender publisher since there is a DOS window to print out to.

After I removed the print statements, the binary I published works fine. I guess because there was no where to print things out, there were internal errors that I could not see.

Thanks to all :smiley:

KingJames


(saluk) #12

Ah, I think I may have had this problem as well a while back. Thanks for figuring it out!

Kind of weird that printing would return error with no where to print to, blender must not be binding the sdout correctly in the exe.


(wiseman303) #13

Glad to hear you got it working! :slight_smile:


(gorgan_almi) #14

I guess its kinda like a NullPointerException in java. stdout probably isn’t bound to anything cos its not used, so when u send data to it its got nowhere to send the data onto so it stalls.

Anyway, thanks KingJames, thats one error i can avoid running into in the future. :slight_smile:


(S_W) #15

Good to know this with the print command…otherwise it would be a long night sometime… :wink:
Thanks! :slight_smile: