Results 1 to 10 of 10
Thread: Python wait command
-
12-12-08, 05:26 PM #1
Python wait command
I have two functions, simplistically function A writes a file, function B formats the written file.
However it seems that function A takes a few seconds to write the file, so when B is executed, it cannot find the file to format because it has not yet been written and so error city yada yada...
Ive been surfing pythons api but have yet to find an adequate wait function or something to delay function B from being executed before the file is written.
Does anyone have any ideas?
Any and all help will be greatly appreciated!
Bun-
-
12-12-08, 05:32 PM #2
Re: Python wait command
Well, if there is no NOP command in python, why not just create a FOR loop that just incriminates an irrelevant variable a few thousand times? It's inefficient but it would work.
-
12-12-08, 05:35 PM #3
Re: Python wait command
Originally Posted by QuickLightning
Need something that works in all scenarios :3
-
-
12-12-08, 06:11 PM #5
Re: Python wait command
Originally Posted by Bunni
-
12-12-08, 06:55 PM #6
Re: Python wait command
What mechanism are you using such that function A and function B are running independently? Threads? Different scripts? Depending on how your doing it, a different solution is necessary.
And yes just spinning on a variable waiting for an event should be avoided.
FYI to delay in python
Code:import time timeInMilliseconds = 1000 time.sleep(timeInMilliseconds)
-
12-12-08, 09:27 PM #7
Re: Python wait command
Originally Posted by Ewok
-
12-13-08, 01:12 AM #8
Re: Python wait command
While python is running, nothing else in the game engine can run, hence the hang since the python code is not returning because of the wait.
I'm still confused over this function B, where does it live and what's running it?
-
01-06-09, 02:34 PM #9
Re: Python wait command
Hmm for stats printing out at a specified time, whats better: using the python event scheduler (sched), or threading.Timer?
-
01-06-09, 02:43 PM #10
Re: Python wait command
using a sdk built in timer
Code:class SomeClass(object): def __init__(self): sdk.createTimer(seconds, self.myCallback) def myCallback(self, privateData, timer): # Do stuff
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks