emericg / OpenSubtitlesDownload

Automatically find and download the right subtitles for your favorite videos!
https://emeric.io/OpenSubtitlesDownload
GNU General Public License v3.0
588 stars 64 forks source link

Handle exit gracefully when running the script in interactive shell for debugging (i.e. in ipython) #5

Closed felagund closed 11 years ago

felagund commented 12 years ago

ipython -i -c "%run ./opensubtitles-download.py --file movie.avi" was failing for me, this fixes that (and does not do anything bad, at least on my machine). I run the script for ipython since it is useful for further debugging - I got the namespaces and variables for free.

Github tells me I request two commits whereas I picked only one, strange:-/.

felagund commented 12 years ago

Hm, it adds the autoclose commit, but I hard reseted my master branch with this: git reset --hard HEAD git pull

emericg commented 12 years ago

Your repo is not synced with mine, you should find a way to either set my repo as a remote repository of yours, or set your master branch to track mine. I don't really know how github fork works so I'm not sure what's best.

I'll look into the sys.exit versus exit.

felagund commented 12 years ago

Yes, that was exactly what I was trying to achieve.

emericg commented 11 years ago

Allright, after (finally) reading something about this issue, I think you where right, sys.exit() should have been used. exit() is recommended for "interactive interpreter shell and should not be used in programs". This pull request cannot be merged after a year of modification on the trunc, I'll do it manually.

http://docs.python.org/2/library/sys.html#sys.exit http://docs.python.org/2/library/constants.html#exit