Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can I run a python script in the background? #3

Open
FMCalisto opened this issue May 2, 2023 · 1 comment
Open

How can I run a python script in the background? #3

FMCalisto opened this issue May 2, 2023 · 1 comment
Assignees
Labels
help wanted Extra attention is needed
Milestone

Comments

@FMCalisto
Copy link
Member

This question was made by @dvirvahav via e-mail, and we will try our best to answer that. Next, we will provide some solution and description for this question.

@FMCalisto FMCalisto added the help wanted Extra attention is needed label May 2, 2023
@FMCalisto FMCalisto added this to the 0.1 milestone May 2, 2023
@FMCalisto FMCalisto self-assigned this May 2, 2023
@FMCalisto
Copy link
Member Author

To run a Python script in the background, you can use the nohup command in Unix-based systems like Linux or macOS. The nohup command allows you to run a command or a script in the background even if you log out or close your terminal window.

Here's an example of how you can use nohup to run your Python script in the background:

nohup python your_script.py > log.out 2>&1 &

In this command, your_script.py is the name of your Python script. The log.out instruction is the name of the log file where the output of your script will be saved. The 2>&1 redirects the error output to the same log file. The & at the end of the command puts the process in the background.

After running this command, you should see a message like:

nohup: ignoring input and appending output to 'log.out'

This is indicating that your script is running in the background. You can safely close your terminal window or log out, and the script will continue to run.

Note that this approach assumes you are running your Python script on a Unix-based system, like Linux or macOS. If you are running your script on Windows, you can use the Python subprocess module to achieve a similar effect. You also have specific answers concerning the Tobii Eye Tracker on StackOverflow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant