title: i ma not able to add a csv to my local file manager
body: <p>Please Help me out in this, i created a software for inventory management, the data file is stored as json, i converted it to a Pandas dataframe and after that to csv, and now i want to save it to a location in my pc, i got the pop up for save as with csv extention, even when i click save after selecting the path to save, its giving me a error : write() argument must be str, not _io.TextIOWrapper</p>
  <p>i am trying to write the file which is getting saved as csv, but its saving an exmpty csv file and the write function is giving me this error</p>
  <p>below is the code:-</p>
  <pre><code>export=Button(text=&quot;Export&quot;)
  export.place(x=540,y=300)
  
  
  
  def export_data():
      with open(&quot;data.json&quot;) as new_file:
          data = json.load(new_file)
          new = pd.DataFrame.from_dict(data, orient=&quot;index&quot;)
          with open(&quot;new_file.csv&quot;, mode=&quot;w&quot;) as new_file_new:
              new.to_csv(new_file_new)
  
  def save_file():
      with open(&quot;new_file.csv&quot;, mode=&quot;r&quot;) as new_file:
          print(new_file)
          file = filedialog.asksaveasfilename(
          filetypes=[(&quot;csv file&quot;, &quot;.csv&quot;)],
          defaultextension=&quot;.csv&quot;)
          fob = open(file, 'w')
          fob.write(new_file)
          fob.close()
  </code></pre>