Skip to content

Script file not be loaded #12813

Answered by candlerb
woohung asked this question in Help Wanted!
Jun 5, 2023 · 1 comments · 6 replies
Discussion options

You must be logged in to vote

Script file at: /opt/netbox/netbox/scripts/check_device.py could not be loaded.

Yes, debugging scripts is currently a pain if they have an error which prevents them from being loaded in the first place.

I gave a workaround at #12766. Basically you take a copy of your script, insert the following lines at the top of it:

#!/opt/netbox/venv/bin/python
import django, os, sys
sys.path.append('/opt/netbox/netbox')
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'netbox.settings')
django.setup()

Then run it using /opt/netbox/venv/bin/python myscript.py (or you can do chmod +x myscript.py then ./myscript.py). Errors which prevent the script being loaded should then be shown.

If I test your scr…

Replies: 1 comment 6 replies

Comment options

You must be logged in to vote
6 replies
@candlerb
Comment options

@woohung
Comment options

@woohung
Comment options

@candlerb
Comment options

@woohung
Comment options

Answer selected by woohung
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants