Skip to content

Instantly share code, notes, and snippets.

@alvesjnr
Created March 15, 2013 15:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alvesjnr/5170573 to your computer and use it in GitHub Desktop.
Save alvesjnr/5170573 to your computer and use it in GitHub Desktop.
def _get_pythonpath(self):
if os.name == 'nt':
p = subprocess.Popen(["set",], shell=True, stdout=subprocess.PIPE)
out, err = p.communicate()
for line in out.split():
if line.startswith("PYTHONPATH"):
return line.split()[1]
else:
p = subprocess.Popen(["echo", "$PYTHONPATH"], shell=True, stdout=subprocess.PIPE)
out, err = p.communicate()
return out.strip()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment