Python IDLE

476 views
Skip to first unread message

coded kid

unread,
May 28, 2012, 8:37:43 AM5/28/12
to Django users
I'm in a big mess now, I've lost my projects due to this errror. I'm
on windows, This is how I encounter the problem; I try to edit my
settings.py in IDLE. After right clicking on the files, I choose open
program with these default file. I choose idle window bat file, and I
clicked Ok. It didn't open, I try to run manage.py runserver on my
DOS. Not working, it will pop up the IDLE Shell and mange.py script by
displaying it in IDLE. It didn't run the server. The logo of my python
files have changed. How can I revert it back to open with IDLE? And
use it as default for my python script?

Andre Terra

unread,
May 28, 2012, 9:38:55 AM5/28/12
to django...@googlegroups.com
For one thing, I don't know of anybody who uses IDLE as their editor for writing complex code like when developing a website with Django.

You can always type 'python manage.py runserver' instead of just 'manage.py runserver' to make sure python is the program that's opening your .py file.

It seems like you have a problem with your file associations. To fix this, go to the registry (Start Menu, Run, regedit) and browse to:

HKEY_CLASSES_ROOT\Python.File\shell\open\command

You should have a string there named '(Default') and its value should be exactly this (including quotes): "C:\Python26\python.exe" "%1" %*

You could have a different python path depending on your installation (say, C:\Program Files\Python27), but you get the gist. Don't forget the quotes and the trailing %*


Cheers,
AT



--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django...@googlegroups.com.
To unsubscribe from this group, send email to django-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.


yati sagade

unread,
May 28, 2012, 11:34:27 AM5/28/12
to django...@googlegroups.com
After you've fixed your file extension association problems as outlined in the previous answer, PLEASE do not use IDLE to do anything remotely close to editing. Go search for "Notepad++", download it and use it to always edit your Python files. To get the contents of the file into IDLE for testing, just import the module. The very thought of using IDLE to edit files gave me goosebumps.

Cheers!
--
Yati Sagade

Twitter: @yati_itay

Organizing member of TEDx EasternMetropolitanBypass
http://www.ted.com/tedx/events/4933
https://www.facebook.com/pages/TEDx-EasternMetropolitanBypass/337763226244869


Message has been deleted

Bill Freeman

unread,
May 30, 2012, 9:40:27 AM5/30/12
to django...@googlegroups.com
On Mon, May 28, 2012 at 12:25 PM, Dennis Lee Bieber
<wlf...@ix.netcom.com> wrote:
> On Mon, 28 May 2012 05:37:43 -0700 (PDT), coded kid
> <duffle...@gmail.com> declaimed the following in
> gmane.comp.python.django.user:
>        IDLE itself is a Python script; though it sounds like you (or
> someone) created a Windows BAT file to act as an intermediate.
>
>        The main problem appears to be that you've associated the "open"
> action with /IDLE/... The normal "open" action for Python (.py) script
> files should be Python.exe (or Pythonw.exe for .pyw). For editing you
> should have/create a <right-click>"Edit" action that invokes your IDLE
> BAT file.
>
>        You'll need to work with the file association commands in Windows to
> reset things so that "open" means RUN the script.
>
>        Unfortunately, different installations have used different names for
> the file types. Here are mine (I had to do "ftype" with no arguments and
> scan the long output to find the Python entries):
>
> E:\UserData\Wulfraed\My Documents>ftype py_auto_file
> py_auto_file="E:\Python25\python.exe" "%1" %*
>
> E:\UserData\Wulfraed\My Documents>ftype pyw_auto_file
> pyw_auto_file="E:\Python25\pythonw.exe" "%1"
>
>
>        Note that ftype only defines the "open"/"run" action for a file.
> (Interesting -- the .pyw doesn't take command line arguments, probably
> to be expected for a double-click open).
>
>        The other half of the basic equation is the file extension to "file
> type" association:
>
> E:\UserData\Wulfraed\My Documents>assoc .py
> .py=py_auto_file
>
> E:\UserData\Wulfraed\My Documents>assoc .pyc
> File association not found for extension .pyc
>
> E:\UserData\Wulfraed\My Documents>assoc .pyw
> .pyw=pyw_auto_file
>
> (This is why I commented that the file type name may differ between
> installs -- the assoc is
>        <.extension> = <file type>
> and ftype is
>        <file type> = <command line to execute>
> As long as the same <file type> is used in both commands the linkage
> works)
>
>        That SHOULD clear up the double-click/<right-click>Open/command line
> running of Python scripts. Setting up an Edit action (on WinXP) requires
> going through either the registry by hand, or opening a directory
> window,
>
> Tools/Folder Options
> File Types (tab)
>        scroll down to PY and PYW entries, select one
>        Details should show "Opens with: python" (or pythonw)
> [Advanced]
>        the default action should be "open" (bold). If there is no "edit"
> action, click [New...]
>
>        Give it Action name "edit" (or "edit with IDLE")
>        Application used to perform action: full path to the IDLE.BAT file
> (in quotes) followed by "%1" (with quotes) for the argument placeholder
> (the file to be edited).
>        Might need to [x] Use DDE; set "Application" to IDLE, set Topic to
> System
>
> {NOTE: I'm paraphrasing from the edit action on my system which uses
> "E:\Python25\Lib\site-packages\pythonwin\Pythonwin.exe" "%1"}
> {I'm not sure if you could skip the BAT file and use
>        "path/to/python.exe" "path/to/IDLE.py" "%1"
> instead}
>
> --
>        Wulfraed                 Dennis Lee Bieber         AF6VN
>        wlf...@ix.netcom.com    HTTP://wlfraed.home.netcom.com/

Last I used it (I've been blessedly Windows free for some time now),
IDLE's editor was fine for editing Python (everyone has their own
favorite code editor), at least giving nice syntax highlighting and
correct (for Python) treatment of the tab key. But it is not really
an IDE (except maybe for projects that are one file, or maybe one
folder).

I'm sure that there are many fine Windows specific solutions.
(Someone mentioned NOTEPAD++. I can't comment, but the list is pretty
good at that sort of judgement.) But let me suggest that you learn to
use a tool that is available on multiple platforms. (If you deploy a
site commercially, your costs, flexibility, and perhaps performance,
will likely be better on a Linux or BSD based VPS or shared host.) My
personal favorite is emacs, but it can be easier to use vim remotely,
and it is more likely to be pre-installed. Yes, there are native
Windows implementations of both, independent of running builds of *nix
configurations under cygwin. While IDLE does run everywhere, it
requires access to the GUI, which can be annoying on a VPS. Though
you can edit locally and push your changes to your VPS using your
revision control system, there are just some times that you have to
edit on your VPS via an SSH terminal connection.

Beware, if you go with vim, that you will have to add plugins to make
it really Python friendly (emacs comes with a python mode). At a
minimum, you should configure vim to always insert spaces when you hit
the TAB key. Without further information, Python will interpret tab
characters as going to the next every 8 column tab stop, while many
modern editors have lost there way, and use tabs as though the stops
were every 4 characters. Indentation is meaningful in Python, so it
causes mysterious problems if there are two lines that you think have
the same indentation, but python things are different (or vice versa)
because one uses tab characters and the other is all spaces.

There are also some fine commercial, cross platform, offerings. I'm
told that Wing IDE even has good Django template modes, and does have
the chops to run Django from within it.

Bill

Also, Django isn't really a click to run kind of application. During
development it really should be run from a command prompt.

Mario Gudelj

unread,
May 30, 2012, 9:59:13 AM5/30/12
to django...@googlegroups.com
You seriously have to give PyCharm a go. It's everything IDE should be and loves django.

doniyor

unread,
May 30, 2012, 10:09:56 AM5/30/12
to django...@googlegroups.com
@somecallitblues: pycharm is not free, right? but i am really willing to give a try for this. i am using for years Aptana studio which is completely fullfulling my wishes, but "pycharm loves django" sounds great!
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.

Mario Gudelj

unread,
May 30, 2012, 10:13:46 AM5/30/12
to django...@googlegroups.com
It's not free but they have a 30 day trial period

To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/314VLw6tOg4J.

To post to this group, send email to django...@googlegroups.com.
To unsubscribe from this group, send email to django-users...@googlegroups.com.

Bill Freeman

unread,
May 30, 2012, 10:19:15 AM5/30/12
to django...@googlegroups.com
Does it do emacs key bindings ;^)
>>>> django-users...@googlegroups.com.
>>>> For more options, visit this group at
>>>> http://groups.google.com/group/django-users?hl=en.
>>>>
>>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msg/django-users/-/314VLw6tOg4J.
>> To post to this group, send email to django...@googlegroups.com.
>> To unsubscribe from this group, send email to
>> django-users...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django...@googlegroups.com.
> To unsubscribe from this group, send email to

doniyor

unread,
May 30, 2012, 10:23:42 AM5/30/12
to django...@googlegroups.com
i dont know, but that would be awesome, do you know if aptana has it? i never thought of key binding til now in aptana.
>>>> django-users+unsubscribe@googlegroups.com.
>>>> For more options, visit this group at
>>>> http://groups.google.com/group/django-users?hl=en.
>>>>
>>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msg/django-users/-/314VLw6tOg4J.
>> To post to this group, send email to django...@googlegroups.com.
>> To unsubscribe from this group, send email to
>> django-users+unsubscribe@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscribe@googlegroups.com.

Bill Freeman

unread,
May 30, 2012, 10:33:36 AM5/30/12
to django...@googlegroups.com
As someone who has burned in some of the more obscure emacs commands,
I find that I'm seldom satisfied with what a vendor calls emacs
bindings (eclipse comes to mind - I wind up setting my source code
files to be edited externally), but its usually still more comfortable
than the native bindings.
>> >>>> django-users...@googlegroups.com.
>> >>>> For more options, visit this group at
>> >>>> http://groups.google.com/group/django-users?hl=en.
>> >>>>
>> >>>
>> >> --
>> >> You received this message because you are subscribed to the Google
>> >> Groups
>> >> "Django users" group.
>> >> To view this discussion on the web visit
>> >> https://groups.google.com/d/msg/django-users/-/314VLw6tOg4J.
>> >> To post to this group, send email to django...@googlegroups.com.
>> >> To unsubscribe from this group, send email to
>> >> django-users...@googlegroups.com.
>> >> For more options, visit this group at
>> >> http://groups.google.com/group/django-users?hl=en.
>> >
>> >
>> > --
>> > You received this message because you are subscribed to the Google
>> > Groups
>> > "Django users" group.
>> > To post to this group, send email to django...@googlegroups.com.
>> > To unsubscribe from this group, send email to
>> > django-users...@googlegroups.com.
>> > For more options, visit this group at
>> > http://groups.google.com/group/django-users?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/cECipuANgrgJ.
>
> To post to this group, send email to django...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users...@googlegroups.com.

Timothy Makobu

unread,
May 30, 2012, 11:32:21 AM5/30/12
to django...@googlegroups.com
Yea, PyCharm is the stuff.

Also have python open python files; the easy way:

Right click any pyton file->Left Click->Open With->Browse->c:\pythonX\bin\python.exe, for example->make sure you tick "always use the selected program to open this kind of file"->Ok

Kurtis Mullins

unread,
May 30, 2012, 4:21:55 PM5/30/12
to django...@googlegroups.com
Back to the original question,

Did you try running "python manage.py runserver" from the command
prompt? As far as changing those icons back to Python, I believe you
have to change your 'Default Program'. I'm not sure which version of
Widnows you're using (or even how to do it in Windows, I'm running
Linux) but I'm sure you could use Google (or duckduckgo.com) for a
quick answer there.

If you still can't run 'runserver', try using your command prompt to
do something along the following (your paths may/will be different)

c:\python27\bin\python.exe c:\my_directory\my_project\manage.py runserver

Basically, you're just telling the Python interpreter (python.exe or
python27.exe) to execute the "manage.py" file. Also, please note:
Python Versions > 2.7.x (3+) will not work with Django at the moment.

Good luck!

kenneth gonsalves

unread,
May 31, 2012, 1:53:13 AM5/31/12
to django...@googlegroups.com
On Thu, 2012-05-31 at 00:13 +1000, Mario Gudelj wrote:
> It's not free but they have a 30 day trial period

if you have an active open source project they will give you a free
license
--
regards
Kenneth Gonsalves

JussiJ

unread,
Jun 6, 2012, 1:39:23 AM6/6/12
to Django users
On May 28, 5:37 am, coded kid <duffleboi...@gmail.com> wrote:

> I'm in a big mess now, I've lost my projects due to this errror. I'm
> on windows,

The Zeus IDE has support for Python:

http://www.zeusedit.com/python.html

Zeus is a fully scriptable programmer's editor any you can even
write Zeus scripts in Python.

NOTE: Zeus is shareware and only runs on the Windows platform.

Jussi Jumppanen
Author: Zeus Editor
Reply all
Reply to author
Forward
0 new messages