Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow to pass python file path as a parameter #35

Open
agentcooper opened this issue Jun 7, 2021 · 5 comments · May be fixed by #36
Open

Allow to pass python file path as a parameter #35

agentcooper opened this issue Jun 7, 2021 · 5 comments · May be fixed by #36

Comments

@agentcooper
Copy link

agentcooper commented Jun 7, 2021

const PYTHON_BRIDGE_SCRIPT = path.join(__dirname, 'node_python_bridge.py');

Most Electron apps pack files into the ASAR archive, so there is no access to node_modules. During build it is possible to copy some resources outside of the ASAR bundle to be accessed later.

Would you accept a PR to provide a custom path to node_python_bridge.py?

@munro
Copy link
Member

munro commented Jul 10, 2021

Ahhh, I see. Yes, send it this way!

I'm thinking there's probably some spec in package.json that allows us to add files as dependencies that I'm sure Electron picks up, perhaps files [0] ?

[0] https://docs.npmjs.com/cli/v7/configuring-npm/package-json#files

@agentcooper
Copy link
Author

@munro I've sent a PR.

AFAIK there is nothing in Electron itself for this, however in one of the popular builders you need to specify those files manually.

@agentcooper
Copy link
Author

agentcooper commented Jul 28, 2021

Until the PR is landed, I am using this hack to make it work with ASAR: electron/electron#9459 (comment) together with following electron-builder config:

{
  "asarUnpack": ["node_modules/python-bridge"]
}

@rishikesh2003
Copy link

I am getting a weird error. Does it have any relation with this issue?
errno: -2, code: 'ENOENT', syscall: 'spawn python', path: 'python', spawnargs: [ 'path_to/node_python_bridge.py' ]

@rishikesh2003
Copy link

I found what causing this error, It's just the wrong symlink in my linux system

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants