Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

start python program at boot

Graphical Environments, Managers, Multimedia & Desktop questions.
Post Reply
Message
Author
peer
Posts: 443
Joined: 2017-03-26 10:14
Has thanked: 8 times
Been thanked: 20 times

start python program at boot

#1 Post by peer »

os: debian 11 kde plasma
python: 3.9.2
I want to start a python program at boot in kde. I created a application launcher. In this launcher I set the name, command and the work path. The launcher works. Then I added the application toe 'autostart' in the settings. When I rebooted the launcher did not work as I expected.
I created a test program that writes the workdirectory to a logfile.
When I start the launcher from the menu the correct workdirectory is shown in the logfile so the workdirectory is set properly.
When I reboot the pc the launcher works but now in the logfile I see my homedirectory in stead of the workdirectory. So there is something wrong.

I do not know if this is a debian problem or a python problem. What can it be???? It seems as if python cannot find the imported package 'os' so perhaps the python path is not set yet.
Here is my test python program:

Code: Select all

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Dec  6 11:45:43 2022

@author: peer
"""

import os

logFile = open("/home/peer/Temp/Python/test.txt","w")

home = os.environ['HOME']
workdirectory = os.getcwd()
logFile.write(home + "\n")
logFile.write(workdirectory + "\n")

logFile.close()

User avatar
kent_dorfman766
Posts: 535
Joined: 2022-12-16 06:34
Location: socialist states of america
Has thanked: 57 times
Been thanked: 70 times

Re: start python program at boot

#2 Post by kent_dorfman766 »

Code: Select all

I want to start a python program at boot in kde.
This statement doesn't make sense. Nothing KDE will start at boot except maybe the login manager. KDE autostart stuff doesn't start until you actually log in.

Post Reply