Skip to content
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
Closed

No history in python3 inside the virtualenv #90

Phyks opened this issue Jan 25, 2016 · 3 comments

Comments

@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
Copy link
Collaborator

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
Copy link
Author

Phyks commented Jan 29, 2016

Ok, will follow this issue. Thanks!

@Lucas-C
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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants