This forum has been archived. All content is frozen. Please use KDE Discuss instead.

How to set an environment variable in dolphin

Tags: None
(comma "," separated)
pepijnkenter
Registered Member
Posts
6
Karma
0
Dear all.

I am trying to set an environment variable in dolphin (PYTHONPATH) so that when I start my python programs from dolphin they will have this environment variable as well. I added the PYTHONPATH to my .bashrc and started dolphin from bash. However, the PYTHONPATH was not passed to dolphin because dolphin didn't become a child of bash but a direct child of init. My guess is that this is to prevent multiple instances.

So, how can I best pass an environment variable to dolphin? I've found the -nofork option but then I can only start dolphin once. This is not ideal.

Thanks in advance.
User avatar
google01103
Manager
Posts
6668
Karma
25
did you export PYTHONPATH=
did you restart KDE after adding the var?
.bashrc changes don't take affect until the file is re-parsed, starting a new konsole tab then starting Dolphin in that tab should do it
does it show in printenv?
Code: Select all
printenv|grep pythonpath


OpenSuse Leap 42.1 x64, Plasma 5.x

pepijnkenter
Registered Member
Posts
6
Karma
0
Yes i have exported the PYTHON path and it shows up when I do printevn | grep PYTHONPATH. However, I am not root on this machine so I cannot restart KDE.

The problem seems to me that dolphin is not a child of bash (as eclipse and kate are). I checked and there was no dolphin instance running before I started it from the command-line.

Here is my ps output:
Code: Select all
~> ps f
  PID TTY      STAT   TIME COMMAND
17994 pts/20   Ss+    0:00 -bash
18177 pts/20   S      0:00  \_ eclipse
18179 pts/20   Sl    16:57      \_ /opt/bin/java -Dosgi.requiredJavaVersion=1.5 -XX:MaxPermSize=256m -Xms40m -Xmx384m -jar /opt/dist/eclipse//plugins/org.
18266 pts/20   Sl     0:00          \_ /opt/bin/python2.7 -u /opt/dist/eclipse/plugins/org.python.pydev_2.6.0.2012062818/pysrc/pycompletionserver.py 41492
10766 pts/0    S      0:00 dolphin
18052 pts/20   S      0:00 dbus-launch --autolaunch 55d3d4562b0ba4a2841d926d00000030 --binary-syntax --close-stderr
18048 pts/20   Sl     0:42 konsole
18057 pts/21   Ss+    0:00  \_ /bin/bash
18099 pts/22   Ss+    0:00  \_ /bin/bash
18487 pts/23   Ss+    0:00  \_ /bin/bash
19562 pts/24   Ss+    0:01  \_ /bin/bash
21603 pts/24   Sl     0:46  |   \_ kate -u [snip]
25904 pts/3    Ss+    0:00  \_ /bin/bash
10693 pts/0    Ss     0:00  \_ /bin/bash
10802 pts/0    R+     0:00      \_ ps f

User avatar
google01103
Manager
Posts
6668
Karma
25
if you open a new Konsole tab is PYTHONPATH what you wish?


OpenSuse Leap 42.1 x64, Plasma 5.x

pepijnkenter
Registered Member
Posts
6
Karma
0
Yes, the PYTHONPATH variable has the correct value when I open a new Konsole tab.
freininghaus
Moderator
Posts
224
Karma
1
OS
What is your KDE version? Since KDE 4.7, the Dolphin process should actually be a child of bash, and the --nofork option that you mentioned does not exist any more.
User avatar
google01103
Manager
Posts
6668
Karma
25
freininghaus wrote:What is your KDE version? Since KDE 4.7, the Dolphin process should actually be a child of bash, and the --nofork option that you mentioned does not exist any more.


using ksysguard I'm seeing Dolphin is a child of kdeint4

Image


OpenSuse Leap 42.1 x64, Plasma 5.x

pepijnkenter
Registered Member
Posts
6
Karma
0
I'm using KDE 4.3.4. I guess that's pretty old.
pepijnkenter
Registered Member
Posts
6
Karma
0
And by the way, I'm using dolphin version 1.3
freininghaus
Moderator
Posts
224
Karma
1
OS
google01103 wrote:using ksysguard I'm seeing Dolphin is a child of kdeint4

Hopefully not so if you run Dolphin from a Konsole - in that case, it should definitely be a child of the shell process.
pepijnkenter wrote:I'm using KDE 4.3.4. I guess that's pretty old.

It's indeed extremely old. The current version is KDE 4.10.1.

Therefore, the solution to your problem is quite easy: upgrade! Which is probably a good idea anyway because a distro that was released in 2009 does probably not get updates any more and is packed with unfixed security vulnerabilities.
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS
As an alternative solution to this issue, create a executable script in $(kde4-config --localprefix)/env with the content you need to setup PYTHONPATH properly. This will ensure it is propagated to Dolphin (and all other applications started as part of your KDE session).


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
User avatar
google01103
Manager
Posts
6668
Karma
25
freininghaus wrote:
google01103 wrote:using ksysguard I'm seeing Dolphin is a child of kdeint4

Hopefully not so if you run Dolphin from a Konsole - in that case, it should definitely be a child of the shell process.


true,


OpenSuse Leap 42.1 x64, Plasma 5.x

pepijnkenter
Registered Member
Posts
6
Karma
0
I talked to the administrator of the system. We are using Redhat Enterprise Linux 6.4, which is the most recent version. It seems to me that this distribution has the emphasis on stability, not on keeping up with the latest version. Anyhow, upgrading is not an option.

I will try bcooksley's solution Monday at work. Thanks all for your help.
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS
Do note that in order for my solution to take effect, it is required to logout and back in again.


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]


Bookmarks



Who is online

Registered users: abc72656, Bing [Bot], daret, Google [Bot], Sogou [Bot], Yahoo [Bot]