Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8482499
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T19:50:53+00:00 2026-06-10T19:50:53+00:00

I am trying to initialize a time object like this: t = datetime.time(0,0,0) but

  • 0

I am trying to initialize a time object like this:

t = datetime.time(0,0,0)

but I am getting this error:

descriptor 'time' requires a 'datetime.datetime' object but received a 'int'

I have these things imported

import datetime
from datetime import datetime, date, time
import time

They seem a bit redundant so I am wondering if this is what is causing the problem

I am also using the strptime method and the combine method

    earliest = datetime.combine(earliest, t)
    value = datetime.strptime(value, format)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T19:50:54+00:00Added an answer on June 10, 2026 at 7:50 pm

    You can create the object without any values:

    >>> import datetime
    >>> datetime.time()
    datetime.time(0, 0)
    

    You, however, imported the class datetime from the module, replacing the module itself:

    >>> from datetime import datetime
    >>> datetime.time
    <method 'time' of 'datetime.datetime' objects>
    

    and that has a different signature:

    >>> datetime.time()
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    TypeError: descriptor 'time' of 'datetime.datetime' object needs an argument
    >>> datetime.time(0)
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    TypeError: descriptor 'time' requires a 'datetime.datetime' object but received a 'int'
    

    Either import the whole module, or import the contained classes, but don’t mix and match. Stick to:

    import datetime
    import time
    

    if you need both modules.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to initialize NSDictionary but it gives me following error: Program received
I'm trying to initialize string with iterators and something like this works: ifstream fin(tmp.txt);
I am trying to initialize directX, but for some reason it can't create d3d
I'm trying to initialize a dictionary with string elements as keys and int[] elements
If DateTime is an object and default C# parameters can only be assigned compile-time
I'm trying to initialize my data in my Azure Data Tables but I only
Say I have an object of type A having Initialize() method. The method receives
This is my second time using C++ and I'm trying to port some Java
I am trying to initialize a static object without success. The purpose is to
I'm trying to initialize a global array of function pointers at compile-time, in either

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.