Topic: Python Script wait statement

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.


Re: Python Script wait statement

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.


Re: Python Script wait statement

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. <standard disclaimer> 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." <standard disclaimer>

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!

Last edited by ivorr (2007-12-12 17:19:38)

The only true wisdom is in knowing you know nothing. -Socrates


Re: Python Script wait statement

As Ivorr mentioned, I was only using the time module to query the current time, <insert whining for NTP here>, 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....


Re: Python Script wait statement


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


Re: Python Script wait statement

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.


Re: Python Script wait statement


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.