Salome HOME
venv directory is configured in config_appli.xml file
[modules/kernel.git] / src / Utils / Utils_Identity.py
index 627d1b9d2c824d8fe745a73635070bcf1aaca1bf..ae771301166d32ea2fb0244b7fe7a26d1ff394b7 100644 (file)
@@ -1,6 +1,6 @@
-#! /usr/bin/env python
+#! /usr/bin/env python3
 #  -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2016  CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2021  CEA/DEN, EDF R&D, OPEN CASCADE
 #
 # Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@@ -49,7 +49,8 @@ def getShortHostName():
     socket.gethostname() gives short or complete Hostname, depending on
     defined aliases.
     """
-    return string.split(socket.gethostname(),'.')[0]
+    hostname = socket.gethostname()
+    return hostname.split('.')[0]
 
 class Identity:
     def __init__(self,name):
@@ -81,7 +82,7 @@ try:
   versnb = string.strip(string.split(s, ":")[1])
   dirname=".salome_"+versnb
   file.close()
-except:
+except Exception:
   versnb = ""
   dirname=".salome"