Unlock Exclusive Benefits
Join Our Community Today!
Join our Community and post in the forum to earn your exclusive badge; celebrating 3 years of the Fortinet Community!
LOGIN/REGISTER
CONTINUE AS A GUEST
Description
This article describes the solution for the '
ModuleNotFoundError
' error on the CodeSnippet Connector. Assuming the xlsxwriter module is required on the codesnippet connector to create certain functions, it is common to encounter this 'ModuleNotFoundError' only when the required module isn't installed on the system.
Invalid code snippet: line 1, in <module>\nModuleNotFoundError: No module named 'xlsxwriter'\n Connector :: code-snippetV2.1.1
Solution
Step 1:
Install the required module with the following command using
pip install <modulename>
.
sudo -u fsr-integrations /opt/cyops-integrations/.env/bin/pip install XlsxWrite
Looking in indexes:
https://pypi.org/simple
,
https://repo.fortisoar.fortinet.com/prod/connectors/deps/simple/
Collecting XlsxWriter
Using cached XlsxWriter-3.2.0-py3-none-any.whl (159 kB)
Installing collected packages: XlsxWriter
Successfully installed XlsxWriter-3.2.0
Step 2:
Check whether the installed module is listed on the global pip.
sudo -u fsr-integrations /opt/cyops-integrations/.env/bin/pip list | grep -i xlsxWrite
XlsxWriter 3.2.0
Step 3
: Remove the __pycache__ and restart the uWSGI services.
sudo rm -rf /opt/cyops/configs/integrations/packages/lib/python3.9/site-packages/__pycache__/
sudo rm -rf /opt/cyops-integrations/.env/lib/python3.9/site-packages/__pycache__/
sudo systemctl restart uwsgi
Now, rerun the playbook and check again.
Terms of Service
Privacy Policy
Cookie Settings