- error TypeError [ERR_INVALID_ARG_TYPE]: The "string" argument must be of type string or an instance of Buffer or ArrayBuffer. Received an instance of PythonShellError
at new NodeError (node:internal/errors:399:5)
at Function.byteLength (node:buffer:793:11)
at apiRes.end
at handler
at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
digest: undefined
}
PythonShellError: ModuleNotFoundError: No module named 'example_module'
at PythonShell.parseError
at terminateIfNeeded
at ChildProcess.<anonymous>
at ChildProcess.emit
at ChildProcess._handle.onexit
----- Python Traceback -----
File "/var/folders/rn/fvrs2khs7hq_hb99d7sqj_0h0000gn/T/pythonShellFile5599925788.py", line 2, in <module>
from example_module import a, b, c{
traceback: 'Traceback (most recent call last):\n' +
' File "/var/folders/rn/fvrs2khs7hq_hb99d7sqj_0h0000gn/T/pythonShellFile5599925788.py", line 2, in <module>\n' +
' from example_module import a, b, c\n' +
"ModuleNotFoundError: No module named 'example_module'\n",
executable: 'python3',
options: null,
script: '/var/folders/rn/fvrs2khs7hq_hb99d7sqj_0h0000gn/T/pythonShellFile5599925788.py',
args: null,
exitCode: 1,
logs: []
}
The Question: Hi,
I'm trying out python-shell in a next.js project and I wasn't able to import my local python module in the script.
I'm using a
pyproject.toml
at the project root to define the local module:This is the error I'm seeing.
Any suggestion is appreciated. Thank you so much.