I have installed recently python3 (3.6.4) on my computer (CentOS 6). I can run it, program with it, and even managed to create a desktop shortcut, by putting "idle3" as a command (If I were to just put "idle", it would open python2). But the problems comes when I what to save the scripts, or when I want to open/save a file.

The python, for what it seems, it has the default directory /home/Barlonium. When I want to open/save a file, I have to change the directory manually, which is annoying.

I have looked for ways of changing the commands of the shortcut, by trying to change the current directory:

cd /home/Barlonium/"Python Projects" && idle3

But I receive the following error:

Details: Failed to execute child process "cd" (No such file or directory)

I have tried to look for some document that contains the path or even how to change it permanently in the shell, but I can't find it on the net.

I want to change it permanently to /home/Barlonium/Python Projects. How can I do it?

P.S.: I'm not really sure if it in this section (unix.stackexchange), but on stackoverflow the Linux's tag clearly says that if it's not a linux-programming issue, this would be the appropriate site.

EDIT: Maybe it will help you helping me, but the shortcut seems to be an application of type application/x-desktop.

EDIT2: Resuming my problem, I don't know how to open python on a different saving folder. How can I do it, either permanently or with the shortcut commands (like I describe on the post)?


This was solved over a discussion in the Unix & Linux chat.

The solution is to create a shortcut for the command

sh -c 'cd /home/Barlonium/"Python Projects" && exec idle3'

The shortcut itself can't be just cd ... && idle3 because it does not know how to evaluate the &&. The sh shell, on the other hand, knows how to do that.

The exec in front of idle3 will replace the sh process with that of the idle3 process.

The Free Desktop standard also says that you should be able to set the working directory using Path="/home/Barlonium/Python Projects" for the shortcut (I'm uncertain how it handles spaces and/or quotes), and have Exec=idle3 (or possibly its full absolute path).

  • 1
    Might want to change that to exec idle3 so that there isn't an unnecessary shell process floating around. – Ignacio Vazquez-Abrams Feb 26 '18 at 17:58
  • @IgnacioVazquez-Abrams Agreed. I've added that. – Kusalananda Feb 26 '18 at 18:01
  • I only wrote sh -c 'cd $HOME/"Python Projects" && idle3' – Saclyr Barlonium Feb 26 '18 at 18:09
  • I mean, I only wrote that and worked. But I already added the exec command, as it was suggested. – Saclyr Barlonium Feb 26 '18 at 18:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.