Anyhow I thought I'd keep this second question in here so other might benefit, but I still am still stumped by what I can't get high resultion time from time.time() which still only reports in hundredths of a second even on this newer version of python. Maybe that's just part of the learning curve. Looks like setitimer is not available with my version of python but how can I tell from the error message? Shouldn't it be saying the module has no method? Calling the missing method an attribute is pretty confusing. So I have to believe it is titmer itself that is having issues.Īha! I just figured out the problem by trying this on a VM with a newer version of python and it works just fine. Is it complaining that it can't find titimer OR is there something wrong with the attributes I'm passing? I was wondering if it couldn't resolve signal.ITIMER_REAL and so tried calling it with a 0 just to see what would happen and now it's telling me: python]#. (See the Unix man page signal(2).) titimer (which, seconds, interval) Sets given interval timer (one of signal.ITIMERREAL, signal.ITIMERVIRTUAL or signal.ITIMERPROF) specified by which to fire after seconds (float is accepted, different from alarm()) and after that every interval seconds. Today we have one single system call to catch all signals but that only appeared in version 4 of Unix and before that there were. For many reasons in fact, they’ve gone through many iterations of development and ideas. They were just a bit different from what we know today. Perhaps part my the problem is that as a new python user I'm still not 'one with python' and perhaps am not understanding what the error message it trying to tell me. Signals have been there since the very first version of Unix. titimer(signal.ITIMER_REAL, 2, 2)ĪttributeError: 'module' object has no attribute 'setitimer' But when I make an exact copy of that example, I get this: python]#. In fact, according to this - python timer mystery it looks pretty easy to use. My second question has to do with setitimer, which according to the docs says it will deliver alarms and the time can be specified as a floating point number. The only thing is when I do this all I get as 2 significant digits and am wondering if I need to import something else or set something in my environment or what. Marketing (current) Powerpoint Pro V2 Presentation Maker. It is also possible to activate an interval timer so that it sends just. I did find answers this questions elsewhere to use using time.time() in python. The timers cause Unix signals (see Chapter 10) to be sent periodically to the process. I'm trying to get the current time as a high resolution number, something easily done with the Time::HiRes module in perl. This is a 2-part question and the first part is simple.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |