Mark7549 commited on
Commit
336b5df
1 Parent(s): b24ad56

added check for non existing path in tmp file creation

Browse files
Files changed (1) hide show
  1. word2vec.py +7 -1
word2vec.py CHANGED
@@ -254,8 +254,14 @@ def store_df_in_temp_file(df):
254
  '''
255
  Store the dataframe in a temporary file
256
  '''
 
 
 
 
 
 
257
  # Create random tmp file name
258
- _, temp_file_path = tempfile.mkstemp(prefix="temp_", suffix=".xlsx", dir="./downloads/nn")
259
 
260
  # Write data to the temporary file
261
  with pd.ExcelWriter(temp_file_path, engine='xlsxwriter') as writer:
 
254
  '''
255
  Store the dataframe in a temporary file
256
  '''
257
+ # Define directory for temporary files
258
+ temp_dir = "./downloads/nn"
259
+
260
+ # Create the directory if it doesn't exist
261
+ os.makedirs(temp_dir, exist_ok=True)
262
+
263
  # Create random tmp file name
264
+ _, temp_file_path = tempfile.mkstemp(prefix="temp_", suffix=".xlsx", dir=temp_dir)
265
 
266
  # Write data to the temporary file
267
  with pd.ExcelWriter(temp_file_path, engine='xlsxwriter') as writer: