Hi all, I am trying to implement a python code to extract some info from website html using beautiful soup, this extracted information is the output I am expecting. but when I try to import the libraries in the code, like below, this throws a security violation error. How do I fix this, please help.
import re
import json
from bs4 import BeautifulSoup
The security violation error occurs because n8n restricts importing Python standard library modules like `re` and external libraries like `BeautifulSoup` by default for security reasons.
For self-hosted n8n, you can enable these modules by:
• Setting environment variables like `N8N_RUNNERS_STDLIB_ALLOW=re,json` and `N8N_RUNNERS_EXTERNAL_ALLOW=beautifulsoup4`
• Configuring a `n8n-task-runners.json` file to allowlist the modules
If you’re using n8n Cloud, these imports aren’t supported. Consider using the HTTP Request node to fetch HTML and then process it with JavaScript in the Code node, or switch to a self-hosted setup for full Python library support.