Reputation: 4043
I recently started a new project using virtualenv 1.10, Python 3.2 and Django 1.7. This is one of several projects, of which the others are all virtualenv 1.10, Python 2.7 and Django 1.6.
I built a script that allows me to pass the project name as an argument that activates the virtual environment, starts Apache and MySQL and runs the Django development server.
This script has worked fine until I added this recent virtual environment and the bits for this new project. Now, when I type the command (either in the terminal or within the start up script):
workon new_project
I get this output:
user@host:~$ workon new_project
bash: cd: one_of_my_other_projects: No such file or directory
(new_project)user@host:~$
I should note that the script works fine and so does the workon
command; but it's kind of strange that the cd
command is run with that particular argument (eg, one_of_my_other_projects
)
Further, in this script, I use aliases (in .bash_profile
) for the changing into the working directories. They have this form:
alias oproj "cd /path/to/django/project"
I thought that since I'm using source
to run this start up script, maybe the aliases were causing the problem (I read through the virtualenvwrapper.sh
and got the impression this could be a conflict). So I removed the aliases and just used string variables in the bash script. This didn't work and gave the same result.
I'm not sure what's happening. The only real clue I have is that this problem only happens with this new project and this project is using different versions of Python and Django.
I'm sure this is some conflict due to my lack of knowledge of bash, Python, etc. I just don't really know where to go from here.
Upvotes: 0
Views: 931
Reputation: 4043
Based on @that other guy's comment, I was able to debug the bash script and get some clues to the issue. Turns out that for some reason (maybe in my fiddling with the script or maybe for some other reason) there was a file called .project
in the virtual environment that held the string one_of_my_other_projects
. I first changed it to say new_project
but this then just cd
ed into that directory and caused a path issue.
I deleted the file (with my fingers crossed) and it worked.
The way I found out that was the problem was that the debug ode showed the virtualenv
script doing a cat on that file. Not sure why, because it seems to not actually accomplish anything useful. Once I looked inside, I discovered my problem.
If @that other guy poses an answer to this question with his comment, I'd be happy to accept it. Otherwise, this answer will be present to help anyone else with a similar problem.
Thanks.
Upvotes: 1