einaregilsson / MyLife

MyLife: A single-user OhLife alternative
MIT License
26 stars 14 forks source link

MyLife Error: Failed to send daily email #13

Closed gsgqgyq closed 4 years ago

gsgqgyq commented 6 years ago

MyLife Error: Failed to send daily email

Traceback (most recent call last):
 File "/base/data/home/apps/p~****-mylife/20180125t214027.407186433536469488/models/dailymail.py", line 97, in send
   old_post, old_type = self.get_old_post(today)
 File "/base/data/home/apps/p~****-mylife/20180125t214027.407186433536469488/models/dailymail.py", line 190, in get_old_post
   old_list = Post.query().fetch(1, offset=random.randint(0, count-1))
 File "/base/alloc/tmpfs/dynamic_runtimes/python27/54c5883f70296ec8_unzipped/python27_dist/lib/python2.7/random.py", line 242, in randint
   return self.randrange(a, b+1)
 File "/base/alloc/tmpfs/dynamic_runtimes/python27/54c5883f70296ec8_unzipped/python27_dist/lib/python2.7/random.py", line 218, in randrange
   raise ValueError, "empty range for randrange() (%d,%d, %d)" % (istart, istop, width)
ValueError: empty range for randrange() (0,0, 0)

Yesterday using the latest version 1.4 installation

jonchui commented 6 years ago

I've been getting this too!

any ideas @einaregilsson ?

einaregilsson commented 6 years ago

Looks like the PostCounter class might have its count set to 0 for some reason, it's supposed to have a complete count of all posts. This happens when trying to get a random post. Can you see the PostCounter instance in the datastore, see what it looks like?

gsgqgyq commented 6 years ago

是这个吗?Is that it?

einaregilsson commented 6 years ago

Yes. There should be only on instance in the datastore. It counts the number of posts, but for some reason its count property is zero. Hmmmm.

gsgqgyq commented 6 years ago

So, how to fix it? I'm sorry I don't understand technology ...

einaregilsson commented 6 years ago

@gagqgs Do you have any posts in the database? Have you written any posts? I'm not sure how this happens, but a quick fix, if you know roughly how many posts you have is just to manually edit the PostCounter object and set its count property to the number of posts you have. But that still doesn't fix the underlying bug.

gsgqgyq commented 6 years ago

I haven't written a diary yet.

einaregilsson commented 6 years ago

Ok, try writing one post in the web interface, then this should work. I'll try to fix the bug when I can, but I'm not sure when that will be.

gsgqgyq commented 6 years ago

Ok, thank you Thank you for your work.