When I make this code into an executable the function of writing a file works, but it writes to a random directory. I'm not sure how to get it to write to my desktop, like it did when it was a regular python file.
Here is my code,
def write(): print('Creating a new file') name = raw_input('Enter a name for your file: ')+'.txt' # Name of text file coerced with +.txt try: file = open(name,'w') # Trying to create a new file or open one file.close() except: print('Something went wrong! Cannot tell what?') sys.exit(0) # quit Python