keneonyeachonam commited on
Commit
5120e2f
·
1 Parent(s): bbef4d5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -8
app.py CHANGED
@@ -146,14 +146,18 @@ def write_file(file_path, content):
146
  # return href
147
 
148
  def download_file(file_path, content):
149
- # Get the user's desktop directory
150
- desktop_dir = os.path.join(os.path.join(os.path.expanduser('~')), 'Desktop')
151
-
152
- # Write the input to a new file on the desktop
153
- with open(os.path.join(desktop_dir, file_path), "w") as f:
154
- f.write(content)
155
-
156
- return "File saved to desktop!"
 
 
 
 
157
 
158
 
159
  # Function to append to a file
 
146
  # return href
147
 
148
  def download_file(file_path, content):
149
+ try:
150
+ # Get the user's desktop directory
151
+ path = "/Users/konyeach"
152
+ desktop_dir = os.path.join(path, 'Desktop')
153
+
154
+ # Write the input to a new file on the desktop
155
+ with open(os.path.join(desktop_dir, file_path), "w") as f:
156
+ f.write(content)
157
+
158
+ return "File saved to desktop!"
159
+ except:
160
+ return "Error occurred while writing to file."
161
 
162
 
163
  # Function to append to a file