sashahart / vex

Run a command in the named virtualenv.
MIT License
372 stars 26 forks source link

No such file or directory: '/Users/user/~/.virtualenv' #24

Closed franciscolourenco closed 9 years ago

franciscolourenco commented 9 years ago

Mac OS X 10.10 Tried with fish and bash Why would this be happening?

$ vex --make test
Traceback (most recent call last):
  File "/usr/local/bin/vex", line 9, in <module>
    load_entry_point('vex==0.0.15', 'console_scripts', 'vex')()
  File "/Library/Python/2.7/site-packages/vex/main.py", line 161, in main
    returncode = _main(os.environ, argv)
  File "/Library/Python/2.7/site-packages/vex/main.py", line 133, in _main
    handle_make(environ, options, make_path)
  File "/Library/Python/2.7/site-packages/vex/make.py", line 28, in handle_make
    os.mkdir(ve_base)
OSError: [Errno 2] No such file or directory: '/Users/user/~/.virtualenv'

The tilde is not being substituted, and is being added to pwd

sashahart commented 9 years ago

Please give me the contents of ~/.vexrc if it is present, and the output from running env

franciscolourenco commented 9 years ago

There is no ~/.vexrc.

$ env
Apple_PubSub_Socket_Render=/private/tmp/com.apple.launchd.xF7QDWOAn0/Render
CMD_DURATION=5.79s
DISPLAY=/private/tmp/com.apple.launchd.zrn39TcdFB/org.macosforge.xquartz:0
EDITOR=subl
HOME=/Users/user
ITERM_PROFILE=Costumized
ITERM_SESSION_ID=w0t1p0
LANG=en_US.UTF-8
LC_CTYPE=UTF-8
LOGNAME=user
LSCOLORS=dxfxcxdxbxegedabagacad
LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.axv=01;35:*.anx=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.axa=00;36:*.oga=00;36:*.spx=00;36:*.xspf=00;36:
PATH=/usr/local/opt/coreutils/libexec/gnubin:/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/usr/local/MacGPG2/bin:.:/Users/user/Dropbox/bin:/Applications/Postgres.app/Contents/MacOS/bin:/Applications/Sublime Text.app/Contents/SharedSupport/bin
PWD=/Users/user/test
SHELL=/usr/local/bin/fish
SHLVL=1
SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.yh5m9dDRvL/Listeners
TERM=xterm
TERM_PROGRAM=iTerm.app
TMPDIR=/var/folders/f0/g3c7gpjn14d09f0wn8zq31h80000gn/T/
USER=user
WORKON_HOME=~/.virtualenv
XPC_FLAGS=0x0
XPC_SERVICE_NAME=0
__CF_USER_TEXT_ENCODING=0x1F5:0x0:0x0
__fish_bin_dir=/usr/local/Cellar/fish/2.1.0/bin
__fish_datadir=/usr/local/Cellar/fish/2.1.0/share/fish
__fish_help_dir=/usr/local/Cellar/fish/2.1.0/share/doc/fish
__fish_sysconfdir=/usr/local/Cellar/fish/2.1.0/etc/fish
fish_color_cwd=A6E22E
fish_color_git_added=green
fish_color_git_clean=green
fish_color_git_copied=magenta
fish_color_git_deleted=red
fish_color_git_dirty=red
fish_color_git_modified=blue
fish_color_git_renamed=magenta
fish_color_git_staged=yellow
fish_color_git_unmerged=red
fish_color_git_untracked=yellow
fish_color_host=FD971F
fish_color_user=F92672
fish_prompt_git_status_added=✚
fish_prompt_git_status_copied=⇒
fish_prompt_git_status_deleted=✖
fish_prompt_git_status_modified=*
fish_prompt_git_status_order=added:modified:renamed:copied:deleted:untracked:unmerged
fish_prompt_git_status_renamed=➜
fish_prompt_git_status_unmerged=!
fish_prompt_git_status_untracked=?
sashahart commented 9 years ago

I see that currently your WORKON_HOME contains a literal tilde character. Normally when you set this in your shell, the shell expands ~ for you before the value of the variable will be used. Unless you have instructed otherwise by enclosing it in quotes. (Ugh)

Personally, my .profile says:

export WORKON_HOME="$HOME/.virtualenvs"

Therefore this is what I see in env

WORKON_HOME=/home/sasha/.virtualenvs

Similarly, virtualenvwrapper's own docs suggest things like this

export PROJECT_HOME=$HOME/Devel

I use $HOME instead of ~ because I use the same .profile across shells, so I want it to be portable. ~ can also work, if you don't put it in quotes. I verified that my understanding of this is correct in zsh, bash and fish.

So, please check if you used quotes to configure your shell here, and change to not use quotes or to use $HOME not in single quotes.

Oh, shell...

sashahart commented 9 years ago

see doc change in fbeab60b86441856b1609f869a8d3df57a6db969

franciscolourenco commented 9 years ago

Yep, did the trick, thank you :+1:

sashahart commented 9 years ago

Thanks very much for bringing this to my attention and being open to the solution :) :cake: