diff --git a/README.md b/README.md index bd9eb62..7d7a71d 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ Automatically save python interpreter code to a file or secret Gist. You can tur ``` bash pip install pysession -echo 'export PYTHONSTARTUP=~/.pysession/pysession.py' >> ~/.bashrc +echo 'export PYTHONSTARTUP=$HOME/.pysession/pysession.py' >> ~/.bashrc ``` If you are using zsh replace `.bashrc` in the above line with `.zshrc` and similarly for any other shell. diff --git a/pysession.py b/pysession.py index ffeed2f..caf385d 100644 --- a/pysession.py +++ b/pysession.py @@ -94,7 +94,7 @@ def load_history_urls(cls): PySession.previous_sessions = pickle.load( io.open(SESSIONS_STORAGE, 'rb')) stdout.write(LAST_GISTS) - for session_url in previous_sessions: + for session_url in PySession.previous_sessions: stdout.write('\t' + session_url + '\n') @classmethod diff --git a/setup.py b/setup.py index cea1b03..acf8e3a 100644 --- a/setup.py +++ b/setup.py @@ -1,4 +1,17 @@ +from __future__ import print_function from setuptools import setup +import os +from os.path import exists, expanduser +from shutil import copyfile + +ROOT = os.path.abspath(os.path.dirname(__file__)) + +print(ROOT) + +if not os.path.exists(expanduser('~') + '/.pysession'): + os.makedirs(expanduser('~') + '/.pysession') + +copyfile(ROOT + '/pysession.py', expanduser('~') + '/.pysession/pysession.py') setup(