#!/usr/bin/env python3

import os
from pathlib import Path

from Pegasus.init import main

pegasus_share_dir = (Path(os.environ["PEGASUS_HOME"]) / "share" / "pegasus").resolve()

main(str(pegasus_share_dir))

#!/usr/bin/env python3
import sys
import os
import subprocess

# Use pegasus-config to find our lib path
bin_dir = os.path.normpath(os.path.join(os.path.dirname(sys.argv[0])))
pegasus_config = os.path.join(bin_dir, "pegasus-config") + " --python-dump"
exec(subprocess.Popen(pegasus_config, stdout=subprocess.PIPE, shell=True).communicate()[0])

# Insert this directory in our search path
os.sys.path.insert(0, pegasus_python_dir)
os.sys.path.insert(0, pegasus_python_externals_dir)

from Pegasus.init import main

main(pegasus_share_dir)


--- 
+++ 
@@ -1,18 +1,10 @@
 #!/usr/bin/env python3
-import sys
+
 import os
-import subprocess
-
-# Use pegasus-config to find our lib path
-bin_dir = os.path.normpath(os.path.join(os.path.dirname(sys.argv[0])))
-pegasus_config = os.path.join(bin_dir, "pegasus-config") + " --python-dump"
-exec(subprocess.Popen(pegasus_config, stdout=subprocess.PIPE, shell=True).communicate()[0])
-
-# Insert this directory in our search path
-os.sys.path.insert(0, pegasus_python_dir)
-os.sys.path.insert(0, pegasus_python_externals_dir)
+from pathlib import Path
 
 from Pegasus.init import main
 
-main(pegasus_share_dir)
+pegasus_share_dir = (Path(os.environ["PEGASUS_HOME"]) / "share" / "pegasus").resolve()
 
+main(str(pegasus_share_dir))
Remove call to p-config, as it is handled in p-python-wrapper
