Wednesday, May 30, 2012

Re: Python IDLE

You seriously have to give PyCharm a go. It's everything IDE should be and loves django.

On 30 May 2012 23:40, Bill Freeman <ke1g.nh@gmail.com> wrote:
On Mon, May 28, 2012 at 12:25 PM, Dennis Lee Bieber
<wlfraed@ix.netcom.com> wrote:
> On Mon, 28 May 2012 05:37:43 -0700 (PDT), coded kid
> <duffleboi911@gmail.com> declaimed the following in
> gmane.comp.python.django.user:
>
>> 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?
>
>        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
>        wlfraed@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.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@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-users@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.

No comments:

Post a Comment