Run python script from Ninox
Hi to all.
I don't know if running a python sfript from Ninox is not possible and just for fun i asked to the AI.
Here's the response:
To launch a Python executable from Ninox, you can do the following steps:
Create a button in Ninox that will trigger the execution of the Python executable.
Set up a script that will execute the Python executable from Ninox. This script can be written in Python itself, or in another scripting language like JavaScript or AppleScript.
For example, if you have the following Python script saved as "sample.py":
python
print("Hello, world!")
- In your Ninox script, use the
do shell script
command to execute the Python script. For example:
javascript
do shell script "/usr/bin/python3 {path_to_script}/sample.py"
Replace {path_to_script}
with the actual path to your Python script on your computer.
- Attach the Ninox script to your button. When you click the button, Ninox will execute the Python script using the
do shell script
command. The output of the Python script will be returned to Ninox as a string, which you can show or manipulate as needed.
*************
I expected it was not possible, but maybe i am wrong, even if this is not running (the code is written in javascript).
Any of you can do the trick?
Thank you fot attention
6 replies
-
Why do you want to use Python when you can run JavaScript?
-
You can try the html() function and Brython (https://brython.info/static_tutorial/en/index.html).
I never use it because I develop with JavaScript.
Let me know if it works. -
this script i made with JS seems to run well:
const axios = require('axios');const cheerio = require('cheerio');const r = 459230;const link = 'https://www.discogs.com/sell/release/';const link_completo = link + r.toString();const headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:94.0) Gecko/20100101 Firefox/94.0','Referer': 'http://www.discogs.com'};console.log(link_completo);axios.get(link_completo, { headers }).then((response) => {const $ = cheerio.load(response.data);const artist = $('h1 a').toArray().map(a => $(a).text().trim()).join(', ');const album = $('h1 span').last().text().trim();const label = $('td a').text().trim()console.log('Artist:', artist);console.log('Album:', album);
i would like to assign it to a button in ninox, is it possible?
-
Thank you alot!
Hope you enjoy your vacation
Content aside
- 1 yr agoLast active
- 6Replies
- 319Views
-
2
Following