Reputation: 8624
When trying to run a project in PyCharm I get the following error. I have setup the virtualbox, vagrant and all the requirements in the readme file they gave me but when pressing run...
ssh://[email protected]:2222/usr/bin/python -u /Users/gtas/Projects/PythonProj/manage.py runserver 0.0.0.0:8000
bash: line 0: cd: /Users/gtas/Projects/PythonProj: No such file or directory
/usr/bin/python: can't open file '/Users/gtas/Projects/PythonProj/manage.py': [Errno 2] No such file or directory
Process finished with exit code 2
EDIT:
It looks like the VM vagrant mappings are not properly configured/set.
I use a Mac OS X 10.9.2 and latest PyCharm IDE.
Upvotes: 18
Views: 108307
Reputation: 10031
Answer : I solved the problem by simply removing .idea
folder. You can try also this way.
I opened in the folder : ".idea" file : "workspace" and corrected the file name that was not possible to open, working fine.
Upvotes: 4
Reputation: 83
I had the exact same issue and what happened to me (I am a very new PyCharm user) is that my "working directory" was pointing to the wrong path where my file was located. I fixed this by right clicking on my ".py" file and selecting "Edit Run Configuration:'pyfile" and adjusting my "working directory" to point to where my file was located. Hope this works for anyone who runs into a similar issue.
Upvotes: 2
Reputation: 81
I faced the same problem and I solved it as follows
Fİle > Settings > project ["your project name"] > Python Interpretor >
Add Interpretor > System Interpretor > Apply
I try it and its working but you can chose local interpretor it can be work.
Upvotes: 8
Reputation: 2013
This can also occur if you delete and subsequently recreate a file in your project where both files have the same name. For example:
foo.py
.foo.py
in PyCharm.foo.py
foo.py
foo.py
Upvotes: 0
Reputation: 11
This problem usually occur when u update the version of python and delete the old dir of python.
May be u can solve the problem by creating a new project with pycharm and copy all the files in a hiding dir named ".idea" in your new project dir to your old projects' "/.idea" dir,and choose replace.
Upvotes: 1
Reputation: 11
if your all setting is right, it may be the issue of pycharm version and you also get this problrm, you can do like this in of Edit configuation your running .py!
Upvotes: 1
Reputation: 4818
Another way to add the project context root in the preferences.
Preferences -> Project Structure -> Add Context Root
Upvotes: 3
Reputation: 193
Since you mention that your setup involves virtual box and vagrant, you may need to update the path mappings in your Vagrantfile. In my case, adding synced paths between the host and vagrant like
config.vm.synced_folder "../code_folder", "/home/vagrant/code_folder"
then a vagrant reload
and a Pycharm restart
solved the problem.
Upvotes: 0
Reputation: 4565
I get this problem whenever I moved a project folder. I've found that the problem is the mapped folder in the virtual machine is no longer accessible; ls
shows something like below:
(vagrant) vagrant@ralph-dev:~/src$ ll
ls: cannot access ralph: No such file or directory
total 8
drwxr-xr-x 3 root root 4096 Jan 11 07:42 ./
drwxr-xr-x 15 vagrant vagrant 4096 Mar 7 09:45 ../
d????????? ? ? ? ? ? ralph/
The solution is do a vagrant reload
. After this the moved folder is mapped correctly.
Upvotes: 0
Reputation: 2123
Started having the same issue after upgrading to PyCharm 3.4 - before that everything was working fine and after the update the same error. Also fixed by updating the path mappings: go to Run/Debug Configurations and manually define the Path mappings - Local path should be the path of your Django project and remote path the path to the project in the vagrant VM.
Upvotes: 28