K00B404 commited on
Commit
16881d3
·
verified ·
1 Parent(s): 534d2e9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -0
app.py CHANGED
@@ -19,6 +19,16 @@ print(f"Home directory writable: {os.access(os.path.expanduser('~'), os.W_OK)}")
19
  print(f"Current directory writable: {os.access(os.getcwd(), os.W_OK)}")
20
  print(f"/tmp writable: {os.access('/tmp', os.W_OK)}")
21
 
 
 
 
 
 
 
 
 
 
 
22
 
23
  # Initialize the database
24
  def init_db(file='logs.db'):
 
19
  print(f"Current directory writable: {os.access(os.getcwd(), os.W_OK)}")
20
  print(f"/tmp writable: {os.access('/tmp', os.W_OK)}")
21
 
22
+ def check_db_writable(file_path):
23
+ try:
24
+ # Open the file in append mode to check for writability
25
+ with open(file_path, 'a'):
26
+ pass # Just opening it to check
27
+ print(f"✅ The database file '{file_path}' is writable.")
28
+ except IOError as e:
29
+ print(f"❌ The database file '{file_path}' is not writable. Error: {e}")
30
+
31
+ check_db_writable(db_file_path)
32
 
33
  # Initialize the database
34
  def init_db(file='logs.db'):