views:

239

answers:

1

I am trying to run my python scripts in the command-prompt without calling python.exe first. I am specifically doing this in relation to running django-admin.py. I have C:\Python26 and C:\Python26\Scripts in my PATH. However, if I try running django-admin.py by doing:

django-admin.py startproject helloworld

I get the message: Type 'django-admin.py help' for usage.

Now, after some experimentation, I realized the problem is that the secondary arguments to these scripts are not being passed for some reason, since I tried it with a some other python scripts I have. I know I could avoid this problem by simply doing:

python C:\Python26\Scripts\django-admin.py startproject helloworld

But I know it should be possible to run the first command only and get it to work, because I had it working before. I've looked everywhere, and not many places have been helpful so any idea would be useful for me at this point.

Update: The .py file associations were set correctly, and the problem is still occuring.

+4  A: 

Check assoc and ftype. If properly set, you can run a .py with arguments.

> assoc .py
.py=Python.File
> ftype Python.File
Python.File="C:\Python26\python.exe" "%1" %*

Depending on how your Python was installed, these may or may not be in place. You can set them with assoc and ftype.

> assoc .py=Python.File
> ftype Python.File="C:\Python26\python.exe" "%1" %*

Also, if .py is included in the PATHEXT environment variable, you can run .py files without the trailing .py.

> set PATHEXT=%PATHEXT%;.py
> django-admin startproject helloworld
ephemient
I've checked and all of those were set properly but I am still having the same issue. I tried uninstalling and reinstalling python but that didn't help solve the problem.
dmanatunga