python-shell icon indicating copy to clipboard operation
python-shell copied to clipboard

Package import error when running electron app

Open DotoPototo opened this issue 6 years ago • 3 comments

I'm calling a python script as such:

let options = {
      scriptPath: bgScriptPath,
      args: ['process-data', '--site-id', site.id]
    }
let pyshell = new PythonShell(bgScriptPath, options, {mode: 'binery '})

This calls the python script correctly but this script has two module imports for two other python scripts I made. When it gets to these other scripts it fails importing modules they have, such as pandas or cv2.

I do have these installed, I am using pipenv for virtual enviroments and they are installed when running pipenv graph. When calling the three python scripts directly from terminal, they work fine, it just fails when calling them from the electron app using python-shell.

I wasn't sure if the scripts were weirdly being called outside of my virtual enviroment but replacing the scripts code with a simple output of "pipenv run pip freeze" shows a list of all the modules in my virtual enviroment including the ones it's saying it can't import.

The kicker is that this was working on my macbook, but it won't work on my Windows PC.

DotoPototo avatar Mar 14 '19 11:03 DotoPototo

Same here!

Script with import pandas works with linux and python-shell. It also works in the python installation in windows, but hangs with python-shell in windows.

Did you find a solution? Any suggestion?

zerocewl avatar Aug 19 '19 15:08 zerocewl

Any solution to this @mikecbone ?

marty331 avatar Apr 05 '20 02:04 marty331

Do the scripts work if you supply a pythonPath option? In my case a module was found when that was present, but not when it was absent.

mcthulhu avatar May 10 '21 02:05 mcthulhu