[RWP] opening .py file in text

Indigo 33indigo at charter.net
Fri Jun 14 07:13:54 EDT 2013


Here's the answer to my own question about opening .py files in text; 
not that I understand anything else in this programmer's forum:
snip:
Stack Exchange
sign up  log in  careers 2.0


Stack Overflow
Questions
Tags
Tour
Users
Ask Question
Tell me more ×
Stack Overflow is a question and answer site for professional and 
enthusiast programmers. It's 100% free, no registration required.
.py files opens up in a text editor when run from cmd
Click here to find out more!
up vote
0
down vote
favorite
Whenever I try to run a .py file from cmd it opens up in a text 
editor(np++). I'm trying to run the following:
django-admin.py startproject testprj
Even if I run 'setup.py install'
python
share|improve this question
asked Nov 30 '10 at 17:58
shwetanka
Shwetanka
9501825

1

What platform? Does django-admin.py have a #! at the top? – nmichaels 
Nov 30 '10 at 18:00

@Nathon: Notepad++ is for Windows. – user225312 Nov 30 '10 at 18:01

@sukhbir good to know. – nmichaels Nov 30 '10 at 18:09
2 Answers
active
oldest
votes
up vote
3
down vote
accepted
You need to change the file association so that .py files open with 
Python executable, typically located in C:\Python<version>\ and not 
Notepad++
Changing this should be easy, but here is how to do it.
Also, read here on to set the environment path so that the Python 
executable is found without you having to navigate to C:\Python2.6.
share|improve this answer
edited Nov 30 '10 at 18:09

answered Nov 30 '10 at 18:03
user225312
user225312
14.6k952103

up vote
2
down vote
Your Windows file associations are set to open .py files in a text 
editor. You have to change those to use the python.exe interpreter, or 
you can prefix all your commands with python, like this:
python django-admin.py startproject testprj
If you want to change your file associations, and you are running Vista 
or Windows 7, you can change them in 'Control Panel'->'Default 
Programs'->'Associate a file type or protocol with a program'
share|improve this answer
answered Nov 30 '10 at 18:02
birryree
birryree
23.5k44990

I'm running the as u said and even set the path to 
%path%;C:\Python26\Lib\site-packages\django\bin but it is giving 
django-admin.py file does not exist. – Shwetanka Nov 30 '10 at 18:12
End snip.
Y




More information about the Rwp mailing list