Spaces:
Runtime error
Runtime error
File size: 510 Bytes
824bd32 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
import os
import logging
def get_file_name_without_ext(file_path):
try:
if not file_path: # Check for empty string
return None
# Extract the base name from the file path
base_name = os.path.basename(file_path)
# Remove the file extension
file_name_without_ext = os.path.splitext(base_name)[0]
return file_name_without_ext
except (TypeError, AttributeError) as e:
logging.error(f"Error processing file path: {e}")
return None |