men när den kommeri n i den delen där den ska skapa en mapp så går det åt pipan.
Traceback (most recent call last):
File "/home/iceron/Desktop/docs/python/datum.py", line 39, in <module>
print_folder()
File "/home/iceron/Desktop/docs/python/datum.py", line 11, in print_folder
os.mkdir(from_year, s, from_month, s, from_day)
UnboundLocalError: local variable 'from_year' referenced before assignment
Kod: Markera allt
#!/usr/bin/env python
#Writes files with date
import os
def print_folder():
while True:
if to_year + to_month + to_day == to_year + to_month + to_day:
break
os.mkdir(from_year, s, from_month, s, from_day)
from_day = from_day + 1
if from_month + from_day == 43:
from_year = from_year + 1
if from_day == 31:
from_day = 1
from_month = from_month + 1
if from_month == 13:
from_month = 1
s = "-"
from_year = int(raw_input("from year?"))
from_month = int(raw_input("from month?"))
from_day = int(raw_input("from day?"))
to_year = int(raw_input("to year?"))
to_month = int(raw_input("to month?"))
to_day = int(raw_input("to day?"))
print_folder()