Home / System Design

Python Script wait statement

CommunityMartin AI Resolved
Started by Casey · 18y ago · 11 views · 6 replies
18y ago

I am writing a script that I want the script to "pause" for 1 second and then proceed. I have seen some use of event.wait(x) but was unclear if this relied on the time module or not because i have not had success in implementing the event.wait() statement due to a runtime error even though syntax is correct.  I have tried loading the time module and useing time.sleep(1). This has some very adverse affects on the Nion, notablly the meters stopped responding and I believe that the controls stopped responding as well, however audio continued to pass.

18y ago

I've had issues with the Python time module also. Officially I believe it is completely unsupported, although it seems quite dandy on a ConMan node. To get what I wanted initially I had to dig up some PPC compiled libraries and manually load them onto the NioNode filesystem, which is DEFINITELY not supported. But all the fun stuff is never supported anyway, such is life...
I would suggest perhaps breaking your script into two pieces, the before and after. Trigger an external delay that in turn fires the 'after' part.

18y ago

The Python time module was omitted in the NION for a pretty good reason. Under certain conditions it can really mess up your box. Commands like "sleep" and others can shut down pion altogether or throw the system timing into the toilet. In the whole Good vs. Bad question, that's a bad thing. I have seen where a few brave souls have taken their warranty into their own hands and installed the time module on a NION or two. It does work BUT the time module can only be queried for date and time of day. If you manage to grenade your NION using the time module, there will be no manufacturer support and all you'll hear from us is something like "Aww, that's too bad. Sorry, not our problem. Better luck next time."
Here's a link to a file successfully using event.wait:
http://downloads.peavey.com/mm/Python_E … serial.npa
If you're REALLY brave or just plain crazy, you've been warned:
http://downloads.peavey.com/mm/Python_Examples/time.so
BTW, thanks for the time module, Jason.
Have a fun day!

18y ago

As Ivorr mentioned, I was only using the time module to query the current time, , I wasn't trying to do any fancy task scheduling. In addition to the Python time shared object download, it has to be placed in the correct location in the file system. Aside from knowledge of that location, which I don't recall off the top of my head as I had to hunt around for it at the time, you need to have a some Linux CLI chops to get it there with the right permissions, ownership, blah blah blah....

18y ago

Hi
This is how I kept track of time in a script that I wrote
import os
if os.name=="posix": #Checks whether it is a linux box, ie a Nion
timenow=eval(os.popen("date -u +%s").read(64)) #no of seconds since the epoch
It sets timenow to the number of seconds since the epoch. By varying the "date -u +%s" string sent to the devices os, you can get the date/time data returned in different formats. See here for a complete list:-
http://www.linuxdevcenter.com/linux/cmd … ath=d/date

18y ago

Note that it is a fantasticaly suboptimal way of getting the date/time... so don't do it too often otherwise you'll just load the NIONs cpu at a fantastic rate.

18y ago

Casey,
As you know, there's probablly 1.34 million different ways to do stuff in NWare.  Depending on what you're trying to do, there may be a really simple aproach.  Wiring a blinker or control delay (as Jason suggested) into your script could easily bring some time aspects into it without having to load all kinds of unsupported libraries.

Log in to reply to this topic.