Home/Support/Support Forum/time loop error

time loop error

0 votes
hello
i'm using the time loop example from the digi micropython guide in Xbee3 Zigbee as below :

import time
print("\nPreparing to print the current time 5 times, once every 5 seconds.")
print("The time format is (year, month, day, hour, second, day, yearday)\n")
for _ in range(5): # Loop 5 times.
print(time.localtime()) # Print out the current time.
print("Pause 5 seconds")
time.sleep(5)
print("Done!")

but i'm getting the below error :
Traceback (most recent call last):
File "<stdin>", line 5, in <module>
AttributeError: 'module' object has no attribute 'localtime'

any help ?
thank you
asked Jan 8 in XBee3 ZigBee by Fahad Faez New to the Community (2 points)

Please log in or register to answer this question.

1 Answer

0 votes
This needs to be uploaded, compiled and run on an XBee 3 cellular module. It should be done using PyCharm so that the proper components can be added.
answered Jan 11 by mvut Veteran of the Digi Community (14,719 points)
...