Error Implementing Scripts #11843
-
|
I recently started using Netbox and am trying to load scripts, but when I did this is the error I get. I thought I restarted the WSGI, but I am not totally sure. How do you restart it exactly?: WSGI service not restarted after upgrade - If this installation has recently been upgraded, check that the WSGI service (e.g. gunicorn or uWSGI) has been restarted. This ensures that the new code is running. The complete exception is provided below: <class 'ModuleNotFoundError'> No module named 'pynetbox' Python version: 3.8.10 |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 10 replies
-
|
When you say "trying to load scripts", what exactly do you mean? Did you put some code in the /opt/netbox/netbox/scripts/ directory? If so, then it seems your custom script is trying to use a module "pynetbox" but you don't have this available in your netbox virtualenv. Try adding pynetbox to If that's not the case, then please can you explain more clearly what you're doing, and show the code. |
Beta Was this translation helpful? Give feedback.
When you say "trying to load scripts", what exactly do you mean? Did you put some code in the /opt/netbox/netbox/scripts/ directory?
If so, then it seems your custom script is trying to use a module "pynetbox" but you don't have this available in your netbox virtualenv. Try adding pynetbox to
local_requirements.txtthen re-runningupgrade.shto rebuild the virtualenv. As an aside though: it would be very unusual for a custom script to use pynetbox, when it has direct access to the Django models and can access the database safely using transactions (this allows the custom script to have a dry run which is rolled back)If that's not the case, then please can you explain more clearly what yo…