添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
相关文章推荐
卖萌的长颈鹿  ·  黄石市生态环境局·  4 月前    · 
想发财的遥控器  ·  swing ...·  6 月前    · 
爱看球的书包  ·  妖狐吧·  9 月前    · 
很酷的莴苣  ·  8.3. 字串型別 | 16 | ...·  10 月前    · 
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!
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