TypeError: date

I have a table with a column of Date type. In the form I have:

def btnAddToCart_click(self, **event_args):
  rightnow = datetime.datetime.now().date()
  Cart = anvil.server.call('ViewEditCart')
  Cart.add_row(DateCreated=rightnow,Product=self.item,Quantity=1)

In server module ViewEditCart is defined as:

def ViewEditCart(): 
  User = anvil.users.get_user()
  if User is not None:
    return app_tables.shoppingcartdetails.client_writable(Customer = User)

When Cart.add_row is executed, I get this error:

TypeError: Required argument 'struct_time' must be of type: 'struct_time' 
at src/lib/datetime.py, line 253 column 4 called from src/lib/datetime.py, 
line 768 column 44

This happened all of the sudden, it worked perfectly before. I believe I didn’t changed any code that would relate to this.

This happened to me a little while back. Just changed overnight, I assumed due to an update or something.

I will try and find the project and what I did to fix it.

For what it’s worth, this is what happened to me. Not sure it’s that similar but might be worth a look :

1 Like

Thanks, David. I reverted to a couple of previous versions and everything is fine again. I re-did the lost code and it works - I don’t have a clue what was going on.