FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Support Bun · Issue #305 · extrabacon/python-shell · GitHub

Repository navigation

Support Bun #305

Description

Describe the bug
python-shell doesn't work on Bun.

Python code
See the below.

Javascript code
https://github.com/extrabacon/python-shell#running-python-code

import { PythonShell } from 'python-shell';

PythonShell.runString('x=1+1;print(x)', null).then((messages) => {
  console.log('finished');
});

Expected behavior
2 is shown.

Actual behavior

$ bun example.js
128 |         this.stderrParser = resolve('parse', options.stderrParser || 'text');
129 |         this.terminated = false;
130 |         this.childProcess = (0, child_process_1.spawn)(pythonPath, this.command, options);
131 |         ['stdout', 'stdin', 'stderr'].forEach(function (name) {
132 |             self[name] = self.childProcess[name];
133 |             self.parser && self[name] && self[name].setEncoding(options.encoding || 'utf8');
                                               ^
TypeError: self[name].setEncoding is not a function. (In 'self[name].setEncoding(options.encoding || "utf8")', 'self[name].setEncoding' is undefined)
      at /Users/exkazuu/ghq/github.com/WillBoosterLab/repair-ai/node_modules/python-shell/index.js:133:42
      at forEach (:1:21)
      at new PythonShell (/Users/exkazuu/ghq/github.com/WillBoosterLab/repair-ai/node_modules/python-shell/index.js:131:9)
      at /Users/exkazuu/ghq/github.com/WillBoosterLab/repair-ai/node_modules/python-shell/index.js:252:27
      at new Promise (:1:21)
      at run (/Users/exkazuu/ghq/github.com/WillBoosterLab/repair-ai/node_modules/python-shell/index.js:251:16)
      at /Users/exkazuu/ghq/github.com/WillBoosterLab/repair-ai/example.js:3:1

Bun v1.1.8 (macOS arm64)

Other Information (please complete the following information):

  • OS: macOS
  • Python Version 3.12.3
  • Node Version Bun v1.1.8 (macOS arm64)

Additional context
Nothing.

Activity

  1. Almenon commented on May 11, 2024

    Collaborator

    This looks like a bug with Bun, not python-shell. Bun should be support nodeJS functions, it's supposed to be compatible. I'll open up a issue there.

  2. Almenon commented on May 11, 2024

    Collaborator

    Created an issue over at oven-sh/bun#11011

  3. Suniron commented on Oct 20, 2024

    Is there a way to bypass this behavior in waiting a Bun update ?

  4. CarlosGamez-Nova commented on Nov 7, 2024

    Deno has the same issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions


      Back | FazBrowse Home | New Git URL