2

How can i open and close any programm on my raspberry pi using python?

I want to open florence.desktop (Virtual Keyboard) and close it. I have tried it with:

P = subprocess.Popen(["/usr/share/applications/florence.desktop"]

but the error message is:

Traceback (most recent call last): File "/usr/lib/python3.7/tkinter/init.py", line 1705, in call return self.func(*args) File "/home/pi/Desktop/Software_1.0.2/Software/Software/Hautpprogramm/Start_Seite.py", line 588, in Wartungs_Button = Button(root, text="Wartungsfunktion", font=bigFont, fg ="black", bg="#D3d3d3", command=lambda: newWindow_Wartung_PW()) File "/home/pi/Desktop/Software_1.0.2/Software/Software/Hautpprogramm/Start_Seite.py", line 165, in newWindow_Wartung_PW P = subprocess.Popen(["/usr/share/applications/florence.desktop"]) File "/usr/lib/python3.7/subprocess.py", line 775, in init restore_signals, start_new_session) File "/usr/lib/python3.7/subprocess.py", line 1522, in _execute_child raise child_exception_type(errno_num, err_msg, err_filename) PermissionError: [Errno 13] Permission denied: '/usr/share/applications/florence.desktop'

1 Answer 1

0

normally you should try to execute your script with sudo, but that wouldn't help here, because you're trying to run a .desktop file, that's not really a program. Try this: subprocess.Popen(["florence"])

Sign up to request clarification or add additional context in comments.

4 Comments

Thanks it works. But now i have an other Problem. I want to show the virtual keyboard on my Window that i opend with Toplevel() in tkinter and not as now on my root window
@SwaggySnape I think this answer might help you: stackoverflow.com/a/43401732/15580216
Ich glaube deutsch funktionier auch :) Ich verstehe den Thread den du geschickt hast nicht ganz.
I tried it myself and I don't think that you could embed florence into a tkinter window. Also please try to write in english, isn't really a rule, but the whole site is english

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.