[Solved]How to set a python script as default program in Linux Mint 20 Cinnamon?
Forum rules
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions use the other forums in the support section.
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions use the other forums in the support section.
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
[Solved]How to set a python script as default program in Linux Mint 20 Cinnamon?
Could somebody provide clear short guidelines (steps) how to set a python script as default to open file (jpg) when I double click on it. Tried to understand a similar post but it is not clear to me. I have picviewer.py and would like to open file pic.jpg located on /home/pics. Please help
Last edited by LockBot on Tue Mar 28, 2023 10:00 pm, edited 2 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Re: How to set a python script as default program in Linux Mint 20 Cinnamon?
In your python script type these two lines of code:
if you can't run your script open the terminal in the folder where the .py file is contained (by right clicking in the folder and then open terminal) and then type:
Code: Select all
import os
os.system("/home/pics/pic.jpg")
Code: Select all
python3 picviewer.py
Re: How to set a python script as default program in Linux Mint 20 Cinnamon?
Thanks for reply, but may be I was not clear enough: my question was not about double clicking on my script, but on any pic in some directory. I need guidelines how to add my script to the list of available default programs to open pics. Thanks
Re: How to set a python script as default program in Linux Mint 20 Cinnamon?
May be it is not really beginner's question
Re: How to set a python script as default program in Linux Mint 20 Cinnamon?
Maybe we should back up and see what is so special about the python script. What does it do to the jpg file?
Can we just put the jpg files in a specific directory and tell the python script to run on all the jpg files in that directory?
Can we just put the jpg files in a specific directory and tell the python script to run on all the jpg files in that directory?
- Dhela Frank
- Level 1
- Posts: 30
- Joined: Sun Sep 12, 2021 5:16 pm
- Location: Uyo, Nigeria
- Contact:
Re: How to set a python script as default program in Linux Mint 20 Cinnamon?
what does the script do?
Re: How to set a python script as default program in Linux Mint 20 Cinnamon?
The script is a picture viewer, and it works fine for opening files when I start the program itself (picture viewer). However, I would like to start it by double clicking on pic file, i.e., want it as default program to open jpg files.
Re: How to set a python script as default program in Linux Mint 20 Cinnamon?
A very reasonable request. Sorry I don't know how to do that.
Re: How to set a python script as default program in Linux Mint 20 Cinnamon?
So you are about to make Cinnamon think your script is Application. Then you can check jpg file Properties -> Open With tab and set your script as a default application
AFAIK you should create (copy) the desktop file for your needs. Just look though
/usr/share/applications/
. There are plenty of them. Place your edited copy to ~/.local/share/applications/
and it should workoutRe: How to set a python script as default program in Linux Mint 20 Cinnamon?
I guess if we are going to keep both of these posts we should create a link to the other post:
viewtopic.php?f=47&t=382702
viewtopic.php?f=47&t=382702