Question

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://vagrant@127.0.0.1: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.

Was it helpful?

Solution

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.

OTHER TIPS

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.

Another way to add the project context root in the preferences.

Preferences -> Project Structure -> Add Context Root

enter image description here

I solved the problem by simply removing .idea folder. You can try also this way.

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.

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.

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.

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!

enter image description here

This can also occur if you delete and subsequently recreate a file in your project where both files have the same name. For example:

  • create a file in the project named foo.py.
  • run foo.py in PyCharm.
  • delete the file foo.py
  • create a new file named foo.py
  • try to run the new foo.py

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top