mirror of
https://github.com/ChuckBuilds/LEDMatrix.git
synced 2026-04-11 13:23:00 +00:00
moving away from dict errors
This commit is contained in:
32
update_pi_files.py
Normal file
32
update_pi_files.py
Normal file
@@ -0,0 +1,32 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Simple script to update files on the Pi
|
||||
"""
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
def copy_file_to_pi(local_file, remote_path):
|
||||
"""Copy a file to the Pi using scp"""
|
||||
try:
|
||||
cmd = ['scp', local_file, f'ledpi@ledpi:{remote_path}']
|
||||
result = subprocess.run(cmd, check=True, capture_output=True, text=True)
|
||||
print(f"Successfully copied {local_file} to {remote_path}")
|
||||
return True
|
||||
except subprocess.CalledProcessError as e:
|
||||
print(f"Error copying {local_file}: {e}")
|
||||
print(f"stderr: {e.stderr}")
|
||||
return False
|
||||
|
||||
if __name__ == "__main__":
|
||||
# Copy the updated web interface file
|
||||
success1 = copy_file_to_pi('web_interface_v2.py', '/home/ledpi/LEDMatrix/')
|
||||
|
||||
# Copy the updated template file
|
||||
success2 = copy_file_to_pi('templates/index_v2.html', '/home/ledpi/LEDMatrix/templates/')
|
||||
|
||||
if success1 and success2:
|
||||
print("All files copied successfully!")
|
||||
print("You can now restart the web interface on the Pi.")
|
||||
else:
|
||||
print("Some files failed to copy. Please check the errors above.")
|
||||
sys.exit(1)
|
||||
Reference in New Issue
Block a user