Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -4,6 +4,44 @@ import pandas as pd
|
|
| 4 |
import openpyxl # Explicitly import openpyxl for Excel support
|
| 5 |
import os
|
| 6 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
# List all files in the /mnt/data/ directory
|
| 8 |
files = os.listdir("/mnt/data/")
|
| 9 |
print("Files in /mnt/data/:", files)
|
|
|
|
| 4 |
import openpyxl # Explicitly import openpyxl for Excel support
|
| 5 |
import os
|
| 6 |
|
| 7 |
+
directory_path = "/mnt/data/"
|
| 8 |
+
|
| 9 |
+
if os.path.exists(directory_path):
|
| 10 |
+
# List files if the directory exists
|
| 11 |
+
files = os.listdir(directory_path)
|
| 12 |
+
print("Files in /mnt/data/:", files)
|
| 13 |
+
else:
|
| 14 |
+
print("Directory does not exist:", directory_path)
|
| 15 |
+
# Optionally, create the directory if needed
|
| 16 |
+
os.makedirs(directory_path)
|
| 17 |
+
print("Directory created:", directory_path)
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
# Primary directory
|
| 21 |
+
directory_path = "/mnt/data/"
|
| 22 |
+
|
| 23 |
+
# Check if primary directory exists; use current directory as fallback
|
| 24 |
+
if not os.path.exists(directory_path):
|
| 25 |
+
print(f"Directory {directory_path} does not exist. Using current directory instead.")
|
| 26 |
+
directory_path = "."
|
| 27 |
+
|
| 28 |
+
# List files in the confirmed directory path
|
| 29 |
+
files = os.listdir(directory_path)
|
| 30 |
+
print("Files in directory:", files)
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
directory_path = "/mnt/data/"
|
| 34 |
+
|
| 35 |
+
try:
|
| 36 |
+
files = os.listdir(directory_path)
|
| 37 |
+
print("Files in /mnt/data/:", files)
|
| 38 |
+
except FileNotFoundError:
|
| 39 |
+
print(f"Error: The directory {directory_path} does not exist.")
|
| 40 |
+
# Handle the error by either using another directory or creating the directory
|
| 41 |
+
os.makedirs(directory_path)
|
| 42 |
+
print("Created directory:", directory_path)
|
| 43 |
+
|
| 44 |
+
|
| 45 |
# List all files in the /mnt/data/ directory
|
| 46 |
files = os.listdir("/mnt/data/")
|
| 47 |
print("Files in /mnt/data/:", files)
|