0

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:

  1. Create a button in Ninox that will trigger the execution of the Python executable.

  2. 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!")

  1. 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.

  1. 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

null
    • Ninox developper
    • Jacques_TUR
    • 1 yr ago
    • Reported - view

    Why do you want to use Python when you can run JavaScript?

      • francescostefanello
      • 1 yr ago
      • Reported - view

      Jacques TUR I am not familiar with JS, and I have my python script ready. Thank you for your interest

    • Ninox developper
    • Jacques_TUR
    • 1 yr ago
    • Reported - view

    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.

    • francescostefanello
    • 8 mths ago
    • Reported - view

    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?

      • Ninox developper
      • Jacques_TUR
      • 8 mths ago
      • Reported - view

       

      There are two solutions:
      1 - Use NativeJS in the code of a Ninox button.
      2 - Create a button using an HTML function.

       I'm on vacation, and I don't have the equipment to give you an example, but I believe you can find one on the forum.

    • francescostefanello
    • 8 mths ago
    • Reported - view

    Thank you alot!

    Hope you enjoy your vacation

Content aside

  • 8 mths agoLast active
  • 6Replies
  • 248Views
  • 2 Following