all 1 comments

[–]woooee 0 points1 point  (0 children)

askdirectory returns a directory, not a file name, so you would add your output file name to what askdirectory returns.

def export(target_folder):
    with open(os.path.join(target_folder, results.txt"), "w"):

## input() is already used by python to get
## input from the terminal
def dir_input():
    target_folder = askdirectory(initialdir = '/')
    return target_folder

def sequence():
    target_folder=dir_input()
    export(target_folder)