Hi everyone,
I'm not entirely sure if I misunderstood the purpose of intervals, but when I try to use it to generate a list of dates I get an unexpected outcome (as far as how generators in python are supposed to work).
For example:
event = maya.intervals(start=maya.now(), end=maya.when('tomorrow'), interval=60*60*24)
for date in event:
print(date.year, date.month, date.day, date.weekday)
Will loop infinitely instead of stopping after printing 1 date (which is what I am expecting).
Is this a feature™?
EDIT:
I also noticed that if I try to change the end to x days in the future, it will continuosly loop over the first date
EDIT2:
I noticed that #169 got pushed a few days ago and it touched how intervals worked, maybe this fixes my problem or if it's already in the pip version it caused it? @timofurrer
EDIT3:
For anyone having my same problem right now and not wanting to build from source, I'm guessing #169 does fix this but it not released yet. if you need 1 day intervals and you don't care about h/m/s granularity, then you can do:
event = maya.intervals(start=maya.now(), end=maya.when('tomorrow'), interval=60*60*23+(60*59)+59)
This way you will get a different day each time you call the generator, with an offset of 1 second per day, meaning that after 86.400 days printed it will repeat one (that's roughly 237 years). Keep this in mind and you can work around the problem.
Hi everyone, I'm not entirely sure if I misunderstood the purpose of intervals, but when I try to use it to generate a list of dates I get an unexpected outcome (as far as how generators in python are supposed to work).
For example:
Will loop infinitely instead of stopping after printing 1 date (which is what I am expecting).
Is this a feature™?
EDIT: I also noticed that if I try to change the end to x days in the future, it will continuosly loop over the first date
EDIT2: I noticed that #169 got pushed a few days ago and it touched how intervals worked, maybe this fixes my problem or if it's already in the pip version it caused it? @timofurrer
EDIT3: For anyone having my same problem right now and not wanting to build from source, I'm guessing #169 does fix this but it not released yet. if you need 1 day intervals and you don't care about h/m/s granularity, then you can do:
event = maya.intervals(start=maya.now(), end=maya.when('tomorrow'), interval=60*60*23+(60*59)+59)
This way you will get a different day each time you call the generator, with an offset of 1 second per day, meaning that after 86.400 days printed it will repeat one (that's roughly 237 years). Keep this in mind and you can work around the problem.