I'm making my first project with Electron. It's a password manager and generator. My main objective right now is to display a randomly generated password into the app using Python Shell, but can't seem to do it.
Python code:
from random import choice
import string
def generator():
value = string.ascii_letters + string.digits + string.punctuation
password = ""
for i in range(0, 21):
random = choice(value)
password += random
print(password)
generator()
Javascript Code:
function getGenerator() {
var generate = document.getElementById("result")
var {PythonShell} = require("python-shell")
var path = require("path")
var options = {
scriptPath : path.join(__dirname, '/../_engine/'),
pythonPath : '/Light/AppData/Local/Microsoft/WindowsApps/python3'
}
var pyshell = new PythonShell('generator.py', options)
pyshell.on('message', function(message) {
swal(message);
})
}
I have no idea what to do really. I'm a newbie with JavaScript so I'm kinda desperate for a direction. Would be really grateful if someone could help me.