File size: 944 Bytes
e3aec0d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import os
import sys

# Simulate HF Space environment where everything is in root
# but locally we are in hf_space subdirectory
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, BASE_DIR)

print(f"Current working directory: {os.getcwd()}")
print(f"Script directory: {BASE_DIR}")

try:
    from data import manager
    print(f"Imported manager from {manager.__file__}")
    print(f"manager.DATA_DIR: {manager.DATA_DIR}")
    print(f"manager.AUDIO_DIR: {manager.AUDIO_DIR}")
    
    # Create data dir if not exists
    os.makedirs(manager.DATA_DIR, exist_ok=True)
    
    # Mock writing file
    test_file = os.path.join(manager.DATA_DIR, "debug_test.txt")
    with open(test_file, "w") as f:
        f.write("test")
    print(f"Wrote test file to {test_file}")
    print(f"Exists? {os.path.exists(test_file)}")
    
except ImportError as e:
    print(f"ImportError: {e}")
except Exception as e:
    print(f"Error: {e}")