Aw: Re: Re: Re: Re: stuck on time

Karsten Hilbert Karsten.Hilbert at gmx.net
Sun Dec 8 09:26:30 EST 2019


> Like this?
>  >>>print_time()
> Traceback (most recent call last)
> File "stdin>", line 1, in <module>
> File "stdin>", line 2, in print_time
> File "stdin>", line 2, in print_time
> File "stdin>", line 2, in print_time
> [Previous line  repeated 996 more times]
> RecursionError: maximum recursion depth excedded.

Sort of, yes, but since you meanwhile redeclared the function:

def print_time():
   print_time()

to be recursive and then you ran that recursive function
it recursed until it ran out of resources.

However,

> Running the code in a shell , it is displaying the time and now also the  date .

That would prove that the code itself is not
the reason why it hangs where you think it
hangs.

I suggest sprinkling print statements about the initial code
and see what it prints to the console to find out where
(and whether) it actually hangs.

Karsten


More information about the Python-list mailing list