Describe the problem/error/question
I need the tiktoken library. I see that pyodide has it supported, but I tried using the code node and just importing tiktoken and it didn’t work. So i also tried shifting over to javascript and trying some code there and it doesn’t work…
Basically I want to grab that element fit_data
and the text from it and just run it through the python code that uses tiktoken to get the token count. If it is more than X tokens, I want to truncate it (I can do that part myself in the code) just the hard part that I am stuck on is getting the correct data element and running my tiktoken encoding on it… See the error please.
What is the error message (if any)?
Problem in node ‘Code‘
AttributeError: ‘NoneType’ object has no attribute ‘new’
Please share your workflow
Share the output returned by the last node
Information on your n8n setup
- n8n version: 1.94.1
- Database (default: SQLite): n/a
- n8n EXECUTIONS_PROCESS setting (default: own, main): manual
- Running n8n via (Docker, npm, n8n cloud, desktop app): website (is this n8n cloud) ?
- Operating system: macos sequioa 15.3.2