This directory contains tools, examples, and templates for the Python Development Extension's user initialization system.
user-init/
├── README.md # This file - overview of the system
├── tools/ # Developer tools (run on development host)
│ └── deploy-to-player.sh # Deploys examples to BrightSign player
├── examples/ # Ready-to-deploy user-init files
│ ├── README.md # Examples-specific documentation
│ ├── requirements.txt # Python packages for automatic installation
│ ├── 01_validate_cv.sh # CV environment validation script
│ └── test_cv_packages.py # Python CV package tests
└── templates/ # Templates for creating custom scripts
├── basic_script.sh # Basic shell script template
├── python_wrapper.sh # Template for running Python scripts
└── requirements_template.txt # Template requirements fileThe Python Development Extension automatically processes files in /storage/sd/python-init/ at startup:
- requirements.txt: Automatically installs Python packages via pip3
- Shell scripts (.sh): Executes scripts with executable permission using bash
- Execution order: Scripts run alphabetically after requirements installation
The extension uses registry keys to control behavior. Configure these via the player's Diagnostic Web Server (DWS) at http://<player-ip>:8080 → Registry tab:
| Registry Key | Default | Description |
|---|---|---|
bsext-pydev-disable-auto-start |
false |
Set to true to prevent extension from starting automatically |
bsext-pydev-enable-user-scripts |
false |
Must be true to enable user script execution (security requirement) |
Security Note: User scripts run as root, so they must be explicitly enabled.
User scripts are disabled by default for security (they run as root). Enable them first:
# Access player's DWS at http://<player-ip>:8080
# Go to Registry tab and enter:
registry write extension bsext-pydev-enable-user-scripts true
# Restart player for changes to take effectcd tools/
export PLAYER_IP=192.168.1.100 # Replace with your player IP
export PASSWORD="password" # Replace with your password
./deploy-to-player.sh "${PLAYER_IP}" "${PASSWORD}"This deploys all files from examples/ to /storage/sd/python-init/ on the player.
# Check extension status
ssh admin@<player-ip> "/var/volatile/bsext/ext_pydev/bsext_init status"
# View initialization logs
ssh admin@<player-ip> "cat /var/log/bsext-pydev.log"
# Check CV test results
ssh admin@<player-ip> "cat /storage/sd/python-init/cv_test.log"Start with a template from templates/:
- basic_script.sh - Simple shell script template
- python_wrapper.sh - Template for running Python scripts
- requirements_template.txt - Template for package installation
Copy and modify templates:
# Copy template
cp templates/basic_script.sh my_custom_script.sh
# Edit for your use case
# Add your initialization logic
# Test locally if possible
bash my_custom_script.sh# Copy to player
scp my_custom_script.sh admin@<player-ip>:/storage/sd/python-init/
# Make executable
ssh admin@<player-ip> "chmod +x /storage/sd/python-init/my_custom_script.sh"
# Restart extension to run script
ssh admin@<player-ip> "/var/volatile/bsext/ext_pydev/bsext_init restart"- Drop
requirements.txtfile in/storage/sd/python-init/ - Packages install automatically at startup
- Uses standard pip requirements format
- Installation logged to
requirements-install.log
Important: PyPI packages must have pre-compiled wheels for the target platform (aarch64/ARM64). The player has no build system (no cmake, gcc, etc.), so packages requiring compilation will fail to install.
Note: /storage/sd is mounted with noexec flag, so the executable bit (chmod +x) has no effect on script execution. All .sh files in /storage/sd/python-init/ are automatically run via bash.
To disable a script, rename it to not end in .sh:
# Disable a script
mv /storage/sd/python-init/01_validate_cv.sh /storage/sd/python-init/01_validate_cv.sh.disabled
# Re-enable it
mv /storage/sd/python-init/01_validate_cv.sh.disabled /storage/sd/python-init/01_validate_cv.shAlternative: Make file unreadable (requires root):
chmod -r /storage/sd/python-init/01_validate_cv.sh # Disable
chmod +r /storage/sd/python-init/01_validate_cv.sh # Enable- Scripts run in alphabetical order
- Use numeric prefixes:
01_setup.sh,02_validate.sh,99_cleanup.sh - Requirements installation always happens first
- Extension logs to
/var/log/bsext-pydev.log - Requirements installation to
/storage/sd/python-init/requirements-install.log - Script output can be redirected to custom log files
- tools/: Scripts for developers to run on their development machine
- templates/: Starting points for creating custom scripts
- examples/: Ready-to-use files that get deployed to
/storage/sd/python-init/ - These files run automatically when the extension starts
- Start with examples: Use provided examples as reference
- Use templates: Templates include proper error handling and logging
- Test incrementally: Test simple scripts before complex ones
- Use descriptive names:
setup_models.shvsscript.sh - Control execution order: Use numeric prefixes when order matters
- Enable/disable easily: Use executable bit for script toggling
- Log appropriately: Direct output to files for debugging
Complete troubleshooting guide: See docs/troubleshooting-user-init.md for comprehensive diagnostics.
Common issues:
- Scripts not running: Verify scripts end in
.shand check registry settings (/storage/sdisnoexec, sochmod +xdoesn't matter - all.shfiles run) - Package installation fails: Check network connectivity and logs
- Import errors: Verify packages installed correctly
- Execution order: Use numeric prefixes to control order
Quick checks:
# 1. Are user scripts enabled? (MOST COMMON ISSUE)
registry read extension bsext-pydev-enable-user-scripts
# Should return "true" - if not: registry write extension bsext-pydev-enable-user-scripts true
# 2. Do scripts exist and end in .sh?
ls -la /storage/sd/python-init/*.sh
# Should list .sh files (executable bit doesn't matter - noexec filesystem)
# 3. Check logs
tail -f /var/log/bsext-pydev.logFor more detailed documentation, see:
- docs/troubleshooting-user-init.md - Complete troubleshooting guide
- examples/README.md - Example-specific documentation
- templates/ - Script templates