technology and webhosting news
It uses a remote synchronization protocol that transfers only the changes between the files, making it an efficient solution for large data transfers. rsync also picks up where it left off when the connection is interrupted.
You’ll also learn about common errors that could occur while running your Python script in Linux and how to troubleshoot them.

Cause: the Python interpreter is not installed or not in the system’s path.

scp [path to file/folder on your machine][username@IP address]:[path to desired location on VPS] 

Create a script with a shebang line, #!/usr/bin/env python3. Make it executable by typing chmod +x [Python script]. Add a cron job crontab -e. Specify the schedule [schedule] /path/to/python3 /path/to/script.py and save. Verify with crontab -1

Prerequisites


scp -P 67003 C:/Users/username/Desktop/Code/* root@31.220.57.32:files

Running Python scripts interactively allows you to execute Python commands line by line in real time, whereas running scripts from the command line allows you to execute the entire script at once. The command line is usually used to execute massive chunks of code that wouldn’t make sense to run in interactive mode.

To launch Python’s interactive mode on your VPS, type Python or Python3 into the terminal to launch the Python interpreter.

sudo yum install epel-releasersync (remote synchronization) is a method for syncing files and directories between two locations. The first time rsync is used, it transfers the entire content of a file or directory.


How to Execute a Python Script in your Linux VPS Command Line

Cause: script does not have execute permissions.

chmod +x [Python file]
chmod +x  executable.py

Troubleshoot: use chmod +x [Python file] to grant execute permissions to your script

When you’re ready, launch the PuTTY SSH client by typing putty into your Linux terminal. Use Ctrl + Alt + T or Command + Option + T if you’re using macOS to open the Terminal.

Refer to the rsync manual for comprehensive documentation and additional options:

To run your script, you’ll need to import it from your local machine, and there are several ways to do this. Each method offers a different approach to transferring data from your machine to your VPS, with varying levels of complexity and security.

bash: python3: command not found

Python’s integration with Linux-based systems is seamless, thanks to the availability of interpreters and libraries in Linux repositories. In this tutorial, we’ll explain how to run a Python script in your remote server’s Linux command line.

First, connect to your VPS using PuTTY. You’ll need to download it to your system to access your server. 

Error message: PermissionError: [Errno 13] Permission denied


2. Executing Python Commands Interactively

which python3  

Error message: no such file or directory: ‘script.py’