Index: palm/trunk/SCRIPTS/palm_gf
===================================================================
--- palm/trunk/SCRIPTS/palm_gf	(revision 4392)
+++ palm/trunk/SCRIPTS/palm_gf	(revision 4393)
@@ -25,4 +25,7 @@
 # -----------------
 # $Id$
+# Removed PALM_BIN dependency
+# 
+# 2825 2018-02-20 21:48:27Z maronga
 # Modified header
 # 
@@ -67,12 +70,16 @@
 
 # Determine PALM directories
+# Determine PALM directories
 try: 
-   devnull = open(os.devnull, 'w')
-   out = sub.check_output("echo $PALM_BIN", shell=True, stderr=sub.STDOUT)
-   palm_bin = out.rstrip()
-   palm_dir = out.split("palm")[0] + "palm/" + out.split("palm")[1].split("/")[1]
-   out = None
+   devnull = open(os.devnull, 'w')      
+   palm_dir = os.getcwd()
+   palm_bin = palm_dir + '/trunk/SCRIPTS'
+   job_dir = palm_dir + '/JOBS'
+   user_dir = palm_dir + '/USER_CODE'
+   with open(palm_bin + '/palmrungui', 'r') as fh:
+      # file found
+      out = None
 except:   
-   print "Error. $PALM_BIN is not set."
+   print ('Error. palm_gf probably called in wrong directory.')
    raise SystemExit
 
Index: palm/trunk/SCRIPTS/palm_gf_files/palm_gf_tools.py
===================================================================
--- palm/trunk/SCRIPTS/palm_gf_files/palm_gf_tools.py	(revision 4392)
+++ palm/trunk/SCRIPTS/palm_gf_files/palm_gf_tools.py	(revision 4393)
@@ -1,2 +1,43 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+#--------------------------------------------------------------------------------#
+# This file is part of the PALM model system.
+#
+# PALM is free software: you can redistribute it and/or modify it under the terms
+# of the GNU General Public License as published by the Free Software Foundation,
+# either version 3 of the License, or (at your option) any later version.
+#
+# PALM is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along with
+# PALM. If not, see <http://www.gnu.org/licenses/>.
+#
+# Copyright 1997-2018  Leibniz Universitaet Hannover
+#--------------------------------------------------------------------------------#
+#
+# Current revisions:
+# -----------------
+# 
+# 
+# Former revisions:
+# -----------------
+# $Id$
+# Initial revision
+# 
+# 
+#
+# 
+#
+# Description:
+# ------------
+# 
+#
+# Instructions:
+# -------------
+#
+#------------------------------------------------------------------------------!
+
 import sys
 import os
@@ -6,6 +47,6 @@
 import palm_gf_conf as configwr
    
-out = sub.check_output("echo $PALM_BIN", shell=True, stderr=sub.STDOUT)
-palm_bin = out.rstrip()
+palm_dir = os.getcwd()
+palm_bin = palm_dir + '/trunk/SCRIPTS'
 
 qtCreatorFile = palm_bin + '/palm_gf_files/palm_gf_table.ui'
Index: palm/trunk/SCRIPTS/palm_jm
===================================================================
--- palm/trunk/SCRIPTS/palm_jm	(revision 4392)
+++ palm/trunk/SCRIPTS/palm_jm	(revision 4393)
@@ -25,4 +25,7 @@
 # -----------------
 # $Id$
+# Removed PALM_BIN dependency
+# 
+# 2825 2018-02-20 21:48:27Z maronga
 # Modified header
 # 
@@ -77,47 +80,50 @@
 
 
+
 # Determine PALM directories
 try: 
-   devnull = open(os.devnull, 'w')
-   out = sub.check_output("echo $PALM_BIN", shell=True, stderr=sub.STDOUT)
-   palm_bin = out.rstrip()
-   palm_dir = out.split("palm")[0] + "palm/" + out.split("palm")[1].split("/")[1]
-   out = None
-      
+   devnull = open(os.devnull, 'w')      
+   palm_dir = os.getcwd()
+   palm_bin = palm_dir + '/trunk/SCRIPTS'
    job_dir = palm_dir + '/JOBS'
    user_dir = palm_dir + '/USER_CODE'
-   
+   with open(palm_bin + '/palm_jm', 'r') as fh:
+      # file found
+      out = None
 except:   
-   print "Error. $PALM_BIN is not set."
+   print ('Error. palm_jm probably called in wrong directory.')
    raise SystemExit
-
 
 
 # MainWindow class
 class JobManager(QtGui.QMainWindow):
-    
+
+        
     def __init__(self):
+
         super(JobManager, self).__init__()
-        
-        self.InitUi()   
-        
+              
+        self.InitUi()         
+
    
     # Initialized MainWindow UI
     def InitUi(self):
 
+        print(palm_bin + '/palm_jm_files/palm_jm.ui')
+
         # Load predefined mainwindow
         uic.loadUi(palm_bin + '/palm_jm_files/palm_jm.ui', self)
 
         self.palm_logo.setPixmap(QtGui.QPixmap(palm_dir  + "/trunk/SCRIPTS/palmrungui_files/logo.png"))
-
 
     
         # Display MainWindow
         self.show()
+        
         QtGui.QApplication.processEvents()
 
+        
         self.load_jobs()
 
-    
     def update_all(self):
  
Index: palm/trunk/SCRIPTS/palm_wd
===================================================================
--- palm/trunk/SCRIPTS/palm_wd	(revision 4392)
+++ palm/trunk/SCRIPTS/palm_wd	(revision 4393)
@@ -25,4 +25,7 @@
 # -----------------
 # $Id$
+# Removed PALM_BIN dependency
+# 
+# 3943 2019-05-02 09:50:41Z maronga
 # Adjustments and bugfixes 
 #
@@ -99,8 +102,7 @@
 
 for i in range(0,len(sys.argv)): 
-   out = sub.check_output("echo $PALM_BIN", shell=True, stderr=sub.STDOUT)
    input_config = str(sys.argv[i])
-   palm_bin = out.rstrip()
-   palm_dir = out.split("palm")[0] + "palm/" + out.split("palm")[1].split("/")[1]
+   palm_dir = os.getcwd()
+   palm_bin = palm_dir + '/trunk/SCRIPTS'
         
 config = configparser.RawConfigParser(allow_no_value=True)
Index: palm/trunk/SCRIPTS/palmrungui
===================================================================
--- palm/trunk/SCRIPTS/palmrungui	(revision 4392)
+++ palm/trunk/SCRIPTS/palmrungui	(revision 4393)
@@ -25,4 +25,7 @@
 # -----------------
 # $Id$
+# Removed PALM_BIN dependency and os calls 
+# 
+# 3487 2018-11-05 07:18:02Z maronga
 # Renamed options -d and -h to -r and -c.
 # 
@@ -75,19 +78,18 @@
 # Determine PALM directories
 try: 
-   devnull = open(os.devnull, 'w')
-   out = subprocess.check_output("echo $PALM_BIN", shell=True, stderr=subprocess.STDOUT)
-   palm_bin = out.rstrip()
-   palm_dir = out.split("palm")[0] + "palm/" + out.split("palm")[1].split("/")[1]
-   out = None
+   devnull = open(os.devnull, 'w')      
+   palm_dir = os.getcwd()
+   palm_bin = palm_dir + '/trunk/SCRIPTS'
+   job_dir = palm_dir + '/JOBS'
+   user_dir = palm_dir + '/USER_CODE'
+   with open(palm_bin + '/palmrungui', 'r') as fh:
+      # file found
+      out = None
 except:   
-   print "Error. $PALM_BIN is not set."
+   print "Error. palmrungui probably called in wrong directory."
    raise SystemExit
 
 
 palmrunline = ""
-name_of_file = os.path.basename(__file__)
-
-palmrungui_path = os.path.realpath(__file__)
-version_path = palmrungui_path[:len(palmrungui_path)-14-len(name_of_file)-1]
 
 Ui_MainWindow = uic.loadUiType("%s/palmrungui_files/mainwindow.ui" % (palm_bin))[0]
@@ -119,5 +121,5 @@
         
         
-        filename = "%s/.palmrun.gui.default" % (version_path)  
+        filename = "%s/.palmrun.gui.default" % (palm_dir)  
         if os.path.exists(filename):
             pass
@@ -165,5 +167,5 @@
         palmrun = QProcess()
         palmrun.setProcessChannelMode(QProcess.MergedChannels) # mergedChannels
-        palmrun.setWorkingDirectory(version_path)
+        palmrun.setWorkingDirectory(palm_dir)
     
         geomet = self.frameGeometry()
@@ -186,5 +188,5 @@
         # Jobs has been submitted or aborted. Continuing...
         # Save the palmrun command to history file
-        filename = "%s/.palm.history" % (version_path)
+        filename = "%s/.palm.history" % (palm_dir)
         tmstamp = strftime("%Y/%m/%d %H:%M")
     
@@ -207,5 +209,5 @@
     ######################################
     def recent_jobs(self, number):
-        fileDir = "%s/.palm.history" % (version_path)
+        fileDir = "%s/.palm.history" % (palm_dir)
         if os.path.exists(fileDir):
             pass
@@ -268,5 +270,5 @@
     ################################
     def choosejob(self):
-        jobDir = "%s/JOBS" % (version_path)        
+        jobDir = "%s/JOBS" % (palm_dir)        
 
         # Pick a job from dialog
@@ -305,5 +307,5 @@
         jobname = filename[:len(filename) - 19];
     
-        fileDir = "%s/.palm.history" % (version_path)
+        fileDir = "%s/.palm.history" % (palm_dir)
         file = open(fileDir,"r")
         history = file.readlines()
@@ -400,5 +402,5 @@
             else:
                 # Check if user code is available
-                usercode = "%s/JOBS/%s/USER_CODE" % (version_path,param[0])
+                usercode = "%s/JOBS/%s/USER_CODE" % (palm_dir,param[0])
                                 
                 if (os.path.exists(usercode) is True): 
@@ -415,5 +417,5 @@
 
                     jobname = self.group_job.findChild(QtGui.QLineEdit, "line_jobname").text()
-                    restartfile = "%s/JOBS/%s/INPUT/%s_p3dr" % (version_path,jobname,jobname)
+                    restartfile = "%s/JOBS/%s/INPUT/%s_p3dr" % (palm_dir,jobname,jobname)
 
                     if (os.path.exists(restartfile) == True):                  
@@ -422,5 +424,5 @@
 
                         if ( drop_job == "Restart run (coupled atmosphere ocean)" ):
-		            restartfileo = "%s/JOBS/%s/INPUT/%s_p3dor" % (version_path,jobname,jobname)
+		            restartfileo = "%s/JOBS/%s/INPUT/%s_p3dor" % (palm_dir,jobname,jobname)
                             if (os.path.exists(restartfileo) == True):                  
                                 self.group_execution.findChild(QtGui.QLabel,"label_restart").setText("hooo")
@@ -480,6 +482,6 @@
                 # Check if _p3dr file is available, otherwise notice user
                 if (status_restarts == 2):
-                    jobname = str(self.group_job.findChild(QtGui.QLineEdit, "line_jobname").text())[len(version_path)+len("/JOBS/"):]
-                    restartfile = "%s/JOBS/%s/INPUT/%s_p3dr" % (version_path,jobname,jobname)
+                    jobname = str(self.group_job.findChild(QtGui.QLineEdit, "line_jobname").text())[len(palm_dir)+len("/JOBS/"):]
+                    restartfile = "%s/JOBS/%s/INPUT/%s_p3dr" % (palm_dir,jobname,jobname)
                     
                     if (os.path.exists(restartfile) == True):                   
@@ -759,5 +761,5 @@
             string_to_file = "%s%s" % (string_to_file,user_string)
         
-        filename ="%s/.palmgui.default" % (version_path)
+        filename ="%s/.palmgui.default" % (palm_dir)
         tmstamp = strftime("%Y/%m/%d %H:%M")
         
@@ -949,7 +951,7 @@
                         self.group_execution.findChild(QtGui.QCheckBox,"check_restarts").setChecked(True) 
                         # Check if _pdf file is available, otherwise notice user
-                        jobname = str(self.group_job.findChild(QtGui.QLineEdit,"line_jobname").text())[len(version_path)+len("/JOBS/"):] 
+                        jobname = str(self.group_job.findChild(QtGui.QLineEdit,"line_jobname").text())[len(palm_dir)+len("/JOBS/"):] 
                         
-                        restartfile = "%sJOBS/%s/INPUT/%s_p3dr" % (version_path,jobname,jobname)
+                        restartfile = "%sJOBS/%s/INPUT/%s_p3dr" % (palm_dir,jobname,jobname)
                         if (os.path.exists(restartfile) == True):   
                             self.group_execution.findChild(QtGui.QLabel,"label_restart").setText("") 
@@ -1024,5 +1026,5 @@
     def open_last(self): 
         # Select filename and open it
-        filename = "%s/.palm.history" % (version_path)
+        filename = "%s/.palm.history" % (palm_dir)
         
         if os.path.exists(filename):
