title: How to create a text file In a folder using python?
body: <p>I am trying to create a .txt file in a folder which is not the directory the script is being run from. I have a folder where the script is, and I am able to create the folder in the same directory the script is in but It won't create the text file in the folder. I usually run in to one of two errors: <code>PermissionError: [Errno 13] Permission denied</code>or, <code>FileNotFoundError: [Errno 2] No such file or directory:</code></p>
  
  <p>This is for a password keeper btw, and to prevent five people telling me it's not secure, I am aware of this, this project is purely educational and I always use placeholders.</p>
  
  <p>There are similar questions to this but they are all for java or c++...</p>
  
  <p>Here is my code:</p>
  
  <pre><code>def main():
      import os
      import os.path
      abc = open("userpassfile.txt", "r+")
      userpassfile = abc.read().strip().split()
      actCheck = input('Do you already have an account?')
      if (actCheck == 'Yes' or actCheck == 'yes'):
          loginUser = input('What is your username?')
          loginPass = input('What is yout password?')
          if (loginUser and loginPass in userpassfile):
              dirCheck = input('Account Settings? [y/n]')
              if (dirCheck == 'y' or dirCheck == 'Y'):
                  print('This function is not working yet!')
                  addpassCheck = input('Would you like to add a password?')
                  if (addpassCheck == 'yes' or addpassCheck == 'Yes'):
                      abc123 = open(loginUser + '.txt', "r+")
                      huehuehue = abc123.read().strip().split()
                      addpass1 = input('What service is the pass')
                      addPass2 = input('What is the password')
                      abc123.write('(' + addpass1 + ',' + addPass2 + ')' + '\n')
  
                  else:
                      print('hihi')
              else:
                  print("hehe")
          else:
              print('Incorrect password or username!')
      else:
          createAct = input('would you like to create one?')
          if (createAct == 'Yes' or createAct == 'yes'):
              save_path = 'C:/Users/Ari Madian/Desktop/Scripts/Python Scripts/Python Password Project'
              createUser = input('What would you like your username to be?:')
              createPass = input('What would you like your password to be?:')
              abc.write(createUser + '\n')
              abc.write(createPass + '\n')
              os.makedirs(createUser)
              completeName = os.path.join(save_path, createUser + ".txt")
  
  
  
  main()
  </code></pre>
  
  <p>If you have any questions about my code, feel free to ask!</p>