-
Notifications
You must be signed in to change notification settings - Fork 159
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
Cannot read property 'join' of undefined #9
Comments
Make sure you add nodeIntegration: true to your mainWindow by adding :
to createWindow() inside main.js |
What I did in 2024 to get get_weather() to work. Comments can only be so long, so will need to fix the spacing and indentation. Make sure you are pointing to the right version of python. I was pointing at a version which didn't even have pip installed, which gave me undefined errors. I used the IPC communication method instead of using Rest APIs. Keep in mind these tips: I used this to initialize the main.js: const { app, BrowserWindow, ipcMain } = require('electron'); And ended the script with code like this: ipcMain.handle('get-weather', async (event, city) => { PythonShell.run('weather_engine.py', options, function (err, results) { In weather_engine.py I changed sys.arv[0] to: if len(sys.argv) > 1: def get_weather(place): In weather.html I inserted a function that began like this: <script> console.log('window.electronAPI:', window.electronAPI); // Outputs the electronAPI object function get_weather() { var city = document.getElementById("city").value; if (!city) { swal("Please enter a city name."); return; } console.log('get_weather called with city:', city); if (window.electronAPI && window.electronAPI.getWeather) { window.electronAPI.getWeather(city) .then(message => { swal(`Weather in ${city}`, message); document.getElementById("city").value = ""; }) (etc...) |
at get_weather (weather.js:10)
at HTMLButtonElement.onclick (weather.html:21)
Am getting this error help me folks
The text was updated successfully, but these errors were encountered: