This may sound strange, but I need a better way to build python scripts than opening a file with nano/vi, change something, quit the editor, and type in python script.py
, over and over again.
I need to build the script on a webserver without any gui. Any ideas how can I improve my workflow?
Running a Script Open the terminal by searching for it in the dashboard or pressing Ctrl + Alt + T . Navigate the terminal to the directory where the script is located using the cd command. Type python SCRIPTNAME.py in the terminal to execute the script.
Open a terminal window and type 'python' (without the quotes). This opens python in interactive mode. While this mode is good for initial learning, you may prefer to use a text editor (like Gedit, Vim or Emacs) to write your code.
Start Thonny by clicking on the Raspberry Pi icon followed by Programming > Thonny Python IDE. Write your program in the top pane, click File > Save as... to save it, and click Run > Run current script to execute the program.
put this line in your .vimrc file:
:map <F2> :w\|!python %<CR>
now hitting <F2>
will save and run your python script
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With