New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No history in python3 inside the virtualenv #90

Closed
Phyks opened this Issue Jan 25, 2016 · 3 comments

Comments

Projects
None yet
3 participants
@Phyks
Copy link

Phyks commented Jan 25, 2016

Hi,

Not sure if this issue is pew-specific or not, but I could not find much information on it… Inside a virtualenv (pew workon venv), I do not have history across different calls of Python.

Is it expected? Is there a way to recover an history?

Thanks!

@berdario

This comment has been minimized.

Copy link
Owner

berdario commented Jan 29, 2016

This is a known Virtualenv bug

I already noticed it before, but I didn't dig to the root cause.

The only solution is a rewrite of virtualenv

I think that adapting virtualenv-rewrite might work.

@Phyks

This comment has been minimized.

Copy link
Author

Phyks commented Jan 29, 2016

Ok, will follow this issue. Thanks!

@Lucas-C

This comment has been minimized.

Copy link
Contributor

Lucas-C commented Jun 30, 2016

As a workaround, here is my .pythonrc (loaded thanks to export PYTHONSTARTUP=~/.pythonrc) :

import atexit, os, readline, sys
if sys.version_info >= (3, 0) and hasattr(sys, 'real_prefix'): # in a VirtualEnv
    PYTHON_HISTORY_FILE = os.path.join(os.environ['HOME'], '.python_history')
    if os.path.exists(PYTHON_HISTORY_FILE):
        readline.read_history_file(PYTHON_HISTORY_FILE)
        atexit.register(readline.write_history_file, PYTHON_HISTORY_FILE)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment