pytz und astimezone () können nicht auf eine naive Datumszeit angewendet werden

Ich habe ein Datum und muss es der Zeitzone zuordnen.

local_tz = timezone('Asia/Tokyo')
start_date = '2012-09-27'
start_date = datetime.strptime(start_date, "%Y-%m-%d")   
start_date = start_date.astimezone(local_tz)


now_utc = datetime.now(timezone('UTC'))
local_now = now_utc.astimezone(local_tz)

Ich muss herausfinden, ob dies zutrifft:

print start_date>local_now

Aber ich bekomme diesen Fehler.

   start_date = start_date.astimezone(local_tz)
   ValueError: astimezone() cannot be applied to a naive datetime

Ich konvertiere UTC nach Tokyo ohne Probleme. Ich muss start_date timezone bewusst machen, dass es in Tokio gut funktioniert.

Vielen Dank

Antworten auf die Frage(3)

Ihre Antwort auf die Frage