How to run script automatically

I created a script that tells me what to wear in the morning according to the weather (for example, a raincoat if it is raining, a heavy jacket if it is cold, etc.). I have a fairly simple programming experience with python, and the script works fine, but I want to be able to create a file that you can simply double-click from my desktop, and the script will automatically run.

My goal is to be able to simply double-click [something] in the morning, and it will automatically run the script and thus tell me what to wear. How can i do this?

I am running python on Mac OSX

Thank!

+3
source share
4 answers

This worked for me on Snow Leopard:

- python script .

- script " "

-Find " " " Python"

, script, script .

, OS X Python Launcher. , :

- python script -

- script :

python "/Users/john/scripts/what-to-wear.py"

( , script what-to-wear.py /Users/john/scripts. , .)

- script. :

chmod 755 what-to-wear-shell-script

- script , python script.

+4

,

: 1. "" → . Windows... :     C:\Python34\python.exe( ) *.py.

: *.bat ... , , - script

+1

Do you want the script to download weather information on the network and display clothes based on your predefined rules?

If so, use urllib to load the page and do special parsing on the loaded html page to get information about it. And write your logic with IF THEN ELSE nested blocks.

-3
source

Source: https://habr.com/ru/post/1724852/


All Articles