Skip to content

Instantly share code, notes, and snippets.

@billiepander
Created April 24, 2017 15:26
Show Gist options
  • Select an option

  • Save billiepander/43699a83a26d41aa9dd767fe280da678 to your computer and use it in GitHub Desktop.

Select an option

Save billiepander/43699a83a26d41aa9dd767fe280da678 to your computer and use it in GitHub Desktop.
import os, sys
os.execv(sys.executable, ['python'] + sys.argv)
# sys.executable: the python path you are using which will auto know if you are using virtualenv
# e.g: /home/pd/.virtualenvs/competehunt_main/bin/python' [so if it not what you want, write it manually]
# of course, sys.argv is the current file name if you donnot add extra params [yes, add it if need to]
# so ['python'] + sys.argv ==> ["python", "current.py"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment