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

Strange error with multiple tracebacks #19

Open
nuklea opened this issue Aug 4, 2015 · 3 comments
Open

Strange error with multiple tracebacks #19

nuklea opened this issue Aug 4, 2015 · 3 comments

Comments

@nuklea
Copy link

nuklea commented Aug 4, 2015

I'm trying to clone python2 virtual env.

$ /usr/bin/python2 -m clonevirtualenv -v ~/.virtualenvs/project ~/.virtualenvs/project-django15
cloning virtualenv '/home/nuklea/.virtualenvs/project' => '/home/nuklea/.virtualenvs/project-django15'...
fixing scripts in bin...
fixing paths in sys.path...

Traceback (most recent call last):
  File "/home/nuklea/.virtualenvs/project-django15/lib/python2.7/site.py", line 703, in <module>
    main()
  File "/home/nuklea/.virtualenvs/project-django15/lib/python2.7/site.py", line 683, in main
    paths_in_sys = addsitepackages(paths_in_sys)
  File "/home/nuklea/.virtualenvs/project-django15/lib/python2.7/site.py", line 282, in addsitepackages
    addsitedir(sitedir, known_paths)
  File "/home/nuklea/.virtualenvs/project-django15/lib/python2.7/site.py", line 204, in addsitedir
    addpackage(sitedir, name, known_paths)
  File "/home/nuklea/.virtualenvs/project-django15/lib/python2.7/site.py", line 177, in addpackage
    if not dircase in known_paths and os.path.exists(dir):
  File "/home/nuklea/.virtualenvs/project-django15/lib/python2.7/genericpath.py", line 26, in exists
    os.stat(path)
TypeError: must be encoded string without NULL bytes, not str

Traceback (most recent call last):
  File "/usr/lib/python2.7/runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/usr/lib/python2.7/site-packages/clonevirtualenv.py", line 307, in <module>
    main()
  File "/usr/lib/python2.7/site-packages/clonevirtualenv.py", line 300, in main
    clone_virtualenv(old_dir, new_dir)
  File "/usr/lib/python2.7/site-packages/clonevirtualenv.py", line 92, in clone_virtualenv
    v_sys = _virtualenv_sys(dst_dir)
  File "/usr/lib/python2.7/site-packages/clonevirtualenv.py", line 66, in _virtualenv_sys
    assert not p.returncode and stdout
AssertionError
$ LC_ALL=C pacman -Qi python2-virtualenv-clone 
Name           : python2-virtualenv-clone
Version        : 0.2.6-1
@anentropic
Copy link

Same problem here

$ virtualenv-clone /data/jenkins/.virtualenvs/master-branch /data/jenkins/.virtualenvs/duplicated-master
Traceback (most recent call last):
  File "/data/jenkins/.virtualenvs/duplicated-master/lib/python2.7/site.py", line 703, in <module>
    main()
  File "/data/jenkins/.virtualenvs/duplicated-master/lib/python2.7/site.py", line 683, in main
    paths_in_sys = addsitepackages(paths_in_sys)
  File "/data/jenkins/.virtualenvs/duplicated-master/lib/python2.7/site.py", line 282, in addsitepackages
    addsitedir(sitedir, known_paths)
  File "/data/jenkins/.virtualenvs/duplicated-master/lib/python2.7/site.py", line 204, in addsitedir
    addpackage(sitedir, name, known_paths)
  File "/data/jenkins/.virtualenvs/duplicated-master/lib/python2.7/site.py", line 177, in addpackage
    if not dircase in known_paths and os.path.exists(dir):
  File "/data/jenkins/.virtualenvs/duplicated-master/lib/python2.7/genericpath.py", line 26, in exists
    os.stat(path)
TypeError: must be encoded string without NULL bytes, not str
Traceback (most recent call last):
  File "/usr/local/bin/virtualenv-clone", line 9, in <module>
    load_entry_point('virtualenv-clone==0.2.6', 'console_scripts', 'virtualenv-clone')()
  File "/usr/local/lib/python2.7/dist-packages/clonevirtualenv.py", line 300, in main
    clone_virtualenv(old_dir, new_dir)
  File "/usr/local/lib/python2.7/dist-packages/clonevirtualenv.py", line 92, in clone_virtualenv
    v_sys = _virtualenv_sys(dst_dir)
  File "/usr/local/lib/python2.7/dist-packages/clonevirtualenv.py", line 66, in _virtualenv_sys
    assert not p.returncode and stdout
AssertionError

It has started to do some stuff, it created the dir:

$ ls /data/jenkins/.virtualenvs/duplicated-master
bin  include  lib  local  man  pip-selfcheck.json  share  src
$ ls /data/jenkins/.virtualenvs/duplicated-master/lib/python2.7/site-packages/
...all the packages appear to have been copied ok...
...but...
$ pip freeze
Traceback (most recent call last):
  File "/data/jenkins/.virtualenvs/duplicated-master/lib/python2.7/site.py", line 703, in <module>
    main()
  File "/data/jenkins/.virtualenvs/duplicated-master/lib/python2.7/site.py", line 683, in main
    paths_in_sys = addsitepackages(paths_in_sys)
  File "/data/jenkins/.virtualenvs/duplicated-master/lib/python2.7/site.py", line 282, in addsitepackages
    addsitedir(sitedir, known_paths)
  File "/data/jenkins/.virtualenvs/duplicated-master/lib/python2.7/site.py", line 204, in addsitedir
    addpackage(sitedir, name, known_paths)
  File "/data/jenkins/.virtualenvs/duplicated-master/lib/python2.7/site.py", line 177, in addpackage
    if not dircase in known_paths and os.path.exists(dir):
  File "/data/jenkins/.virtualenvs/duplicated-master/lib/python2.7/genericpath.py", line 26, in exists
    os.stat(path)
TypeError: must be encoded string without NULL bytes, not str

Ubuntu 14.04.3 LTS (GNU/Linux 3.13.0-66-generic x86_64)

@anentropic
Copy link

more info, the script has done something weird to the path in the original virtualenv

if I edit /data/jenkins/.virtualenvs/master-branch/lib/python2.7/genericpath.py in my original virtualenv and add a debugging print like:

def exists(path):
    """Test whether a path exists.  Returns False for broken symbolic links"""
    try:
        os.stat(path)
    except os.error:
        return False
+    except TypeError as e:
+       print path
+        raise
    return True

then I see this:

$ /data/jenkins/.virtualenvs/master-branch/bin/python
/data/jenkins/.virtualenvs/duplicated-master/src/txstatsd/data/jenkins/.virtualenvs/duplicated-master/src/pyelasticsearch/data/jenkins/.virtualenvs/duplicated-master/src/django-dirtyfields/src/data/jenkins/.virtualenvs/duplicated-master/src/django-oauth2-provider/data/jenkins/.virtualenvs/duplicated-master/src/neomodelimport sys; new=sys.path[sys.__plen:]; del sys.path[sys.__plen:]; p=getattr(sys,'__egginsert',0); sys.path[p:p]=new; sys.__egginsert = p+len(new)
Traceback (most recent call last):
  File "/data/jenkins/.virtualenvs/master-branch/lib/python2.7/site.py", line 703, in <module>
    main()
  File "/data/jenkins/.virtualenvs/master-branch/lib/python2.7/site.py", line 683, in main
    paths_in_sys = addsitepackages(paths_in_sys)
  File "/data/jenkins/.virtualenvs/master-branch/lib/python2.7/site.py", line 282, in addsitepackages
    addsitedir(sitedir, known_paths)
  File "/data/jenkins/.virtualenvs/master-branch/lib/python2.7/site.py", line 204, in addsitedir
    addpackage(sitedir, name, known_paths)
  File "/data/jenkins/.virtualenvs/master-branch/lib/python2.7/site.py", line 177, in addpackage
    if not dircase in known_paths and os.path.exists(dir):
  File "/data/jenkins/.virtualenvs/master-branch/lib/python2.7/genericpath.py", line 26, in exists
    os.stat(path)
TypeError: must be encoded string without NULL bytes, not str

note the messed up path printed at the top, referencing the duplicated virtualenv, though I have no virtualenv activated and I am trying to run python from my original virtualenv

@anentropic
Copy link

the packages from my pip requirements installed as editable seem like they may be implicated somehow

e.g. /data/jenkins/.virtualenvs/duplicated-master/src/txstatsd in the bad path above corresponds to

-e git+git://github.com/myorg/txstatsd.git@50c77b8df8e1dc5ffaf1ba853691d3da280c1b39#egg=txstatsd

in my requirements.txt file

same for all the other parts in the bad path
(before it starts spitting out actual python code import sys; ...)

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