Title: Unable to import module · Issue #299 · extrabacon/python-shell · GitHub
Open Graph Title: Unable to import module · Issue #299 · extrabacon/python-shell
X Title: Unable to import module · Issue #299 · extrabacon/python-shell
Description: 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. const messages = await PythonShell.runString(`from example_module import a, b, c`); I'm using a pyprojec...
Open Graph Description: 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. const messages = await PythonShell.runString(`from example_modul...
X Description: 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. const messages = await PythonShell.runString(`from examp...
Opengraph URL: https://github.com/extrabacon/python-shell/issues/299
X: @github
Domain: patch-diff.githubusercontent.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Unable to import module","articleBody":"\u003c!--If you are having a problem inside your python code please do not create a issue here. \r\nPython-shell just runs your python code, it is not responsible for any errors in the code itself.--\u003e\r\n\r\n**The Question**:\r\nHi, \r\n\r\nI'm trying out python-shell in a next.js project and I wasn't able to import my local python module in the script. \r\n\r\n```ts\r\nconst messages = await PythonShell.runString(`from example_module import a, b, c`);\r\n```\r\n\r\nI'm using a `pyproject.toml` at the project root to define the local module:\r\n\r\n```toml\r\n[tool.poetry]\r\npackages = [{include = \"example_module\", from = \"python\"}]\r\n\r\n[tool.poetry.dependencies]\r\npython = \"\u003e=3.11,\u003c3.13\"\r\nbayesian = {path = \"./python/example_module\", develop = true }\r\n```\r\n\r\nThis is the error I'm seeing.\r\n\r\n```bash\r\n- 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\r\n at new NodeError (node:internal/errors:399:5)\r\n at Function.byteLength (node:buffer:793:11)\r\n at apiRes.end \r\n at handler \r\n at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {\r\n digest: undefined\r\n}\r\nPythonShellError: ModuleNotFoundError: No module named 'example_module'\r\n at PythonShell.parseError\r\n at terminateIfNeeded\r\n at ChildProcess.\u003canonymous\u003e\r\n at ChildProcess.emit\r\n at ChildProcess._handle.onexit\r\n ----- Python Traceback -----\r\n File \"/var/folders/rn/fvrs2khs7hq_hb99d7sqj_0h0000gn/T/pythonShellFile5599925788.py\", line 2, in \u003cmodule\u003e\r\n from example_module import a, b, c{\r\n traceback: 'Traceback (most recent call last):\\n' +\r\n ' File \"/var/folders/rn/fvrs2khs7hq_hb99d7sqj_0h0000gn/T/pythonShellFile5599925788.py\", line 2, in \u003cmodule\u003e\\n' +\r\n ' from example_module import a, b, c\\n' +\r\n \"ModuleNotFoundError: No module named 'example_module'\\n\",\r\n executable: 'python3',\r\n options: null,\r\n script: '/var/folders/rn/fvrs2khs7hq_hb99d7sqj_0h0000gn/T/pythonShellFile5599925788.py',\r\n args: null,\r\n exitCode: 1,\r\n logs: []\r\n}\r\n```\r\n\r\nAny suggestion is appreciated. Thank you so much.\r\n","author":{"url":"https://github.com/DawChihLiou","@type":"Person","name":"DawChihLiou"},"datePublished":"2023-08-16T13:28:23.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/299/python-shell/issues/299"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:d0ef07b5-5279-d9d6-037e-d8e259887df8 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | CE7A:308A8E:330D1AC:4241D76:6974ED73 |
| html-safe-nonce | 277889e56978e99359be67f70c21e8877f3ae5081a1774d83e780a73313ffd32 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDRTdBOjMwOEE4RTozMzBEMUFDOjQyNDFENzY6Njk3NEVENzMiLCJ2aXNpdG9yX2lkIjoiNjU0NjI3MzIxNTk4NTI4MjQxOSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | fd4b4f1b73b03a6fcd203112b47e2b19171940b18e844cf28869fc927111be9e |
| hovercard-subject-tag | issue:1853248947 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/extrabacon/python-shell/299/issue_layout |
| twitter:image | https://opengraph.githubassets.com/f8902083fb1be41ff1c1df99b6c76b24a1278a7ac088bb587610896e2adb7ce9/extrabacon/python-shell/issues/299 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/f8902083fb1be41ff1c1df99b6c76b24a1278a7ac088bb587610896e2adb7ce9/extrabacon/python-shell/issues/299 |
| og:image:alt | 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. const messages = await PythonShell.runString(`from example_modul... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | DawChihLiou |
| hostname | github.com |
| expected-hostname | github.com |
| None | 4a4bf5f4e28041a9d2e5c107d7d20b78b4294ba261cab243b28167c16a623a1f |
| turbo-cache-control | no-preview |
| go-import | github.com/extrabacon/python-shell git https://github.com/extrabacon/python-shell.git |
| octolytics-dimension-user_id | 1558613 |
| octolytics-dimension-user_login | extrabacon |
| octolytics-dimension-repository_id | 17671651 |
| octolytics-dimension-repository_nwo | extrabacon/python-shell |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 17671651 |
| octolytics-dimension-repository_network_root_nwo | extrabacon/python-shell |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 488b30e96dfd057fbbe44c6665ccbc030b729dde |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width