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

fixup_script_() is run on python2 executable #5

Closed
foutrelis opened this issue Jun 11, 2012 · 2 comments
Closed

fixup_script_() is run on python2 executable #5

foutrelis opened this issue Jun 11, 2012 · 2 comments

Comments

@foutrelis
Copy link

Trying to clone a Python 2 virtual environment on Arch Linux results in the following error:

Traceback (most recent call last):
File "/usr/bin/virtualenv-clone", line 9, in
load_entry_point('virtualenv-clone==0.2.3', 'console_scripts', 'virtualenv-clone')()
File "/usr/lib/python2.7/site-packages/clonevirtualenv.py", line 247, in main
clone_virtualenv(old_dir, new_dir)
File "/usr/lib/python2.7/site-packages/clonevirtualenv.py", line 70, in clone_virtualenv
fixup_scripts(src_dir, dst_dir, version)
File "/usr/lib/python2.7/site-packages/clonevirtualenv.py", line 98, in fixup_scripts
rewrite_env_python=rewrite_env_python)
File "/usr/lib/python2.7/site-packages/clonevirtualenv.py", line 126, in fixup_script_
bang = lines[0].decode('utf-8').strip()
File "/usr/lib/python2.7/encodings/utf_8.py", line 16, in decode
return codecs.utf_8_decode(input, errors, True)
UnicodeDecodeError: 'utf8' codec can't decode byte 0xd8 in position 24: invalid continuation byte

Looking into why this happens, I found that virtualenv-clone runs fixup_script_() on $HOME/.virtualenvs/test2/bin/python2 — 'test2' being the target virtualenv and 'python2' being the Python 2 interpreter executable.

I'm not sure how this should be fixed; maybe ignore binary files or add 'python2' (and 'python3'?) to the ignored filenames in fixup_scripts().

@edwardgeorge
Copy link
Owner

could you try the latest changes just pushed to master?

lastreleasedversion...master

the changes both increase the number of patterns of ignored files as well as ignoring binary files in fixup_scripts_()

@foutrelis
Copy link
Author

Works correctly now.

Thanks!

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

2 participants