Cross - Platform Problems

(J09) #1

Does anybody know why this script works in Ubuntu (python 2.4.1) , but not on Macs (python 2.5)? I know that it doesn’t work, because when the script is run, the actuator is not activated.

import GameLogic
cont = GameLogic.getCurrentController()
own = cont.getOwner()
act = cont.getActutor("act")

saveFile = open("status.txt", "w")


The file that runs the script is the same in both cases, run off a flash drive, so I don’t think that there can be any mistakes of that nature. Unfortunately, I can’t debug it on the Macs, because I don’t have access to the terminal. Both computers are running Blender 2.44. Thanks!


(scabootssca) #2

Well only thing I see that might be a problem is that the file might be created in the blender root directory instead of the .blend directory. (I’ve had that problem before)
And another thing i see is that I’m pretty sure mac uses \r Instead of
like unix/linux and
like windows.
But I know nothing about macs and have never used one.


(IanC) #3

The location of the file is important. I’m guessing you’re trying to write to a directory you don’t have permissions to.


(J09) #4

Scabootssca: the
or \r doesn’t seem to be the problem (or there are additional problems).
lanC: so to move the file location, I can just replace

 saveFile = open("status.txt", "w") 


 saveFile = open("/media/FLASHDRIVE/status.txt", "w") 


Is there a way to specify the “current directory”, instead of writing it out? 'cuz otherwise it will be different in different OSs.