0

I am using a Python script to connect to a launched Gdb server. In my code I have used

os.system('./debug.sh')

where debug.sh content is

gdb main.x < debug >& debug.log

when I check debug.log I find the output as follows

Could not find platform independent libraries <prefix>
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
ImportError: No module named site

Although when I run the script directly from the terminal the command gets executed and Gdb client connects with no issues. I'm not sure if the issue is tied to Gdb command but when I tried executing other commands instead like echo I faced no issues. I tried doing as the error says and according to the answers to "ImportError: No module named site" on Windows and Python/IPython ImportError: no module named site I prepended those line to debug.sh

export PYTHONHOME=/usr/bin
export PYTHONPATH=/usr/lib/python2.7
export PATH=$PYTHONHOME:$PATH

But I still got

ImportError: No module named site

I also tried unsetting PYTHONHOME as the second link suggests but that didn't work. If I run a Python shell from the terminal and run

import site

I face no issues, So I am not really sure what's the issue here. I am working on a Redhat7 machine. Thanks in advance.

Merolla
  • 315
  • 2
  • 10

0 Answers0