Can't open file '': [Errno 2] No such file or directory


I'm using Python 2.7, Django 1.2.5 and on Windows 7.

I am not sure what I've done. I used to be able to create Django projects like

python startproject test

Now however I get this error.

Can't open file '':
[Errno 2] No such file or directory

I can type the following which works.

python C:\Python27\Scripts\ startproject test

How can I have it the way it used to be? Not having the type the full path to the file.

Things I've already tried:

I uninstalled Python and manually removed the values from the PATH variable in Windows. Reinstalled Python. Deleted Django and reinstalled it too.

I've added C:\Python27\Scripts to my PATH and PYTHONPATH variable under Environmental Variables in Windows.

Any suggestions?

My PATH variable contains

C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files (x86)\ActiveState Komodo Edit 6\;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\django-apps;F:\My_Projects;C:\Program Files (x86)\QuickTime\QTSystem\;C:\Program Files\TortoiseSVN\bin;C:\Program Files\Mercurial\bin;C:\Python27;C:\Python27\Scripts


2/6/2015 5:32:02 PM

I had this same problem with slightly newer versions of Python 2.7.x and Django - and it is not the PATH. This is all I had to do to fix it in Windows XP:

  1. Find a .py file (any, even a blank).
  2. Right click on it and choose: "Open with>" and then select "Choose program...".
  3. This pops up a list of all programs - select python, and check the box "Always use the selected program to open this kind of file" and then click OK.

Checking this box resets file associations and fixes this problem for the command line.

The cause of the problem: Telling Windows to open up .py files in a text editor as default.

2/6/2015 5:39:12 PM

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow