title: Python: How do I pass a file path as parameter to a function without defining it as a string before putting it into the function?
body: <p>My end goal is to have a user copy and paste a file path into a PySimpleGUI without having to put quotes around the file path.</p>
  <p>Here is the a brief summary of the function:</p>
  <pre><code>def fun1(filepath):
  normal = os.path.normpath(filepath)
  raw_data = pd.read_csv(normal)
  # more code
  return X_Angle, Y_Angle
  </code></pre>
  <p>Then here is the function implemented into PySimpleGui</p>
  <pre><code> sg.theme('BluePurple')
  
  layout = [[sg.Text('paste filepath'), sg.Text(size=(15,1), key='-OUTPUT-')],
            [sg.Input(key='-IN-'), sg.Text(size=(15,1), justification='center'), sg.FileBrowse()],
            [sg.Text(key='-BING-'), sg.Text(size=(2,1)), sg.Text('(X_Angle, Y_Angle)')],
            [sg.Button('Show'), sg.Button('Exit')]]
  
  window = sg.Window('Pattern 2B', layout)
  
  while True:  # Event Loop
      event, values = window.read()
      print(event, values)
      if event == sg.WIN_CLOSED or event == 'Exit':
          break
      if event == 'Show':
          window['-BING-'].update(fun1(values['-IN-']))
          
        
          # Update the &quot;output&quot; text element to be the value of &quot;input&quot; element
         
      
  
  window.close
  </code></pre>
  <p>The error I get is &quot;PermissionError: [Errno 13] Permission denied: '.'&quot;
  Which I believe is just do to the backslashes in the file path. The function works fine when I copy and paste the filepath into the function with quotes around it and r in front of it so its read as a raw string. However, my goal is to make this so the user can just copy and go.</p>