Solved

Python IDLE

Posted on 2014-09-25
19
510 Views
Last Modified: 2014-09-27
I finally decided to learn Python and just downloaded version 3.41 on my Windows 8.1.  For the life of me, I couldn't find any information on where to download Python IDLE for windows OS (only for Mac).

Anyone could help give me some guidance???
Thanks,
pax
0
Comment
Question by:cpeters5
  • 6
  • 6
  • 5
  • +1
19 Comments
 
LVL 82

Expert Comment

by:Dave Baldwin
ID: 40345307
When I downloaded Python 2.7.8 for Windows, IDLE was included with it.  I believe it is included with Python 3.4.1 also.  You may have to add the Python program directory to your Path and then set IDLE as the default program to open 'py' files.  https://docs.python.org/3.4/library/idle.html
0
 

Author Comment

by:cpeters5
ID: 40345383
No luck, no IDLE.  Perhaps it is W8.1 thing.
Seems several things are not consistent with tutorials.  For example:
- the buildin print function requires enclosing the string with round brackets.  For instance
 >>>print "Testing"

will throw invalid syntax error, while

>>>print ("Testing")

will print output correctly.

Also, some other build-in functions were missing.  Found so far - unicode() and  raw_input().

Perhaps I need to install some modules?
0
 
LVL 82

Expert Comment

by:Dave Baldwin
ID: 40345406
Did you install the 'x86' (32-bit) or the 'x86-x64' (64-bit) version?
0
 
LVL 82

Expert Comment

by:Dave Baldwin
ID: 40345428
I installed Python 3.4.1 on one of my other Windows XP systems.  It does include IDLE.  I can right-click on my 'py' files and one of the options is 'Edit with IDLE'.  

In the Doc folder, there is a help file.  It mentions a Python program called 2to3 which will convert programs with Python 2 syntax to Python 3 syntax.
0
 
LVL 82

Expert Comment

by:Dave Baldwin
ID: 40345458
I am pleased to report that the 2to3.py program in the C:\Python34\Tools\Scripts directory fixed the '2to3' syntax differences in my demo files and now they work perfectly.
0
 
LVL 28

Expert Comment

by:pepr
ID: 40345483
Python IDLE is Tkinter (Tcl/Tk) application. Check the batch launcher c:\Python34\Lib\idlelib\idle.bat or the Python launcher c:\Python34\Lib\idlelib\idle.pyw

If you are familiar with any other decent editor (like Notepad++), and if you feel you can use the cmd window, you can live just fine without IDLE.
0
 

Author Comment

by:cpeters5
ID: 40345789
I installed 3.4.1 32bits.    According to one of the tutorial blog, the 64bits version may have some compatible issues.

I assume IDLE is a gui.  Posted the question because I couldn't find it in my python installation folder.  I am ok with using command window and vim or Notepad++, which I used when coding Perl anyway.

The problem now is these missing build-in functions unicode() and raw_input() and perhaps some others I don't know of yet...

Do you have to install any package to get them?
0
 

Author Comment

by:cpeters5
ID: 40345813
Dave Baldwin,
my .py extension is associated to IDLE. But when I double clicked on the file, it was sent directly to python interpreter on command window.

Here is my file type association for Python.


C:\Users\pax>ftype python.File
python.File="C:\WINDOWS\py.exe" "%1" %*

C:\Users\pax>
C:\Users\pax>ftype python.compiledfile
python.compiledfile="C:\WINDOWS\py.exe" "%1" %*

C:\Users\pax>
C:\Users\pax>ftype python.noconfile
python.noconfile="C:\WINDOWS\pyw.exe" "%1" %*
0
 
LVL 28

Expert Comment

by:pepr
ID: 40345821
Tcl/Tk (wrapped as Tkinter) in Python is GUI framework. Did not you find the idle.bat and idle.pyw mentioned above? They should be parts of the installation.

The raw_input was renamed to input in Python 3. The unicode() function should be replaced by str(). Think about it the waz that the unicode() was expected to return a unicode string. In Python 3, all strings are unicode strings -- hence the str() as the exact replacement.
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

Author Comment

by:cpeters5
ID: 40345866
pepr, Thanks!  
No idle.bat came with the installer I got from python web site.  :-(
https://www.python.org/downloads/release/python-341/

I downloaded Windows x86 MSI installer, the last one on the list at the bottom of the page.
0
 
LVL 28

Accepted Solution

by:
pepr earned 500 total points
ID: 40345885
I have personally used the https://www.python.org/ftp/python/3.4.1/python-3.4.1.msi , and the batch is there. However, I am using Windows 7, and I do not know if there is or is not any difference caused by the version of Windows. The content of the idle.bat is:
@echo off
rem Start IDLE using the appropriate Python interpreter
set CURRDIR=%~dp0
start "IDLE" "%CURRDIR%..\..\pythonw.exe" "%CURRDIR%idle.pyw" %1 %2 %3 %4 %5 %6 %7 %8 %9

Open in new window

0
 

Author Comment

by:cpeters5
ID: 40345933
Thank you pepr.  Found idle.bat in the lib/idle folder.  
When I activated it,  I got the Python 3.4.1 shell.  Is the the IDLE gui?  

Now all I have to do is to change file type assoc for .py to open with idle.bat...

What does your  `ftype python.File`  statement looks like?
0
 
LVL 28

Expert Comment

by:pepr
ID: 40345966
Python Shell is the part of IDLE. When you open file (File - Open... CTRL+O), the editor window will appear. When you F5 in the editor, the code results will be observed in Python shell again...

If you are used to Perl, Notepad++, cmd and the way to work with the separate tools, give IDLE a try and decide whether it brings anything new when compared with tools that you already know. (Possibly the Debug window? But I do not use it.)

My ftype... shows
python.File="C:\Windows\py.exe" "%1" %*

Open in new window


You probably should not change it. This is a Python launcher for Windows. It interprets the #!python3 line of the script to launch Python 3, and #!python2 line to launch Python 2. It allows you to work with Python scripts the way resembling the Unix way.
0
 
LVL 82

Expert Comment

by:Dave Baldwin
ID: 40346774
I run my Python programs by right-clicking on the file name and selecting 'Edit with IDLE' as I said above.
0
 
LVL 2

Expert Comment

by:Nas-Banov
ID: 40347729
@cpeters5, you may consider downloading Python 2.7 instead of 3, you might be better off with that - from what i see, the tutorials/books or sources you are learning from are for 2.x. The choice which one to get is not as clear as with other software - python 2.x is more widespread than 3, 2.7 comes pre-install on Macs etc - and does not seem to be going away any time soon. The reason is that BDFL decided to break backwards compatibility when releasing version 3 of python to "get things right" this time. So things are shuffled around (e.g. as you noticed raw_input() is called now input(), print is a "proper" function and requires parenthesis etc).

This said, if you know python 2, switching to python 3 is not difficult. But if you are just learning, new features of 3 will be unwelcome distraction.

ps. Amusingly, some of 3.x features can be used in 2.x by getting them "back from the future" by using "import print_function from __future__"
0
 
LVL 28

Expert Comment

by:pepr
ID: 40347856
Well, I disagree with the preference of Python 2 these days. It was true in the past, but not now. The Python 3 is simply better and cleaner language. If switching to from Python 2 to Python 3 is not difficult then the other way should not be more difficult. Actually, using Python 3 the way how Python 2 would be used is a kind of standing on brakes.

More versions of Python can be installed in the same OS side-by-side, and installation of any version (probably on all OSes) is easy.

If a heavy literature (both mentally and physically [like 1000 pages or so]) is a problem for you, have a look at "Dive Into Python 3" by Mark Pilgrim (http://www.diveintopython3.net/). Nice to read, nice to look at, nice to think about the presented code. The Appendix A (http://www.diveintopython3.net/porting-code-to-python-3-with-2to3.html) summarizes the differences between Python 2 and Python 3.
0
 

Author Comment

by:cpeters5
ID: 40347886
Dave Baldwin, Yes I did that and it works fine now.  I am used to Notepad++ and might just use it instead of IDLE.

  Nas-Banov,  Since I am still fresh off the boat in Python community, I wouldn't know the difference between the old and new version.  So I might just go with the most current stable version.  Also I like  how version 3.* handles unicode.  

pepr: You are correct that I have been following tutorial for the old version, that was my main cause of confusion.  Didn't realize it until later.  I am now reading https://docs.python.org/3/tutorial and it is very readable.  Love the simplicity of Python (comparing to Perl).   Thanks for Mark Pilgrim's paper.  I will give it a try very soon.

Thank you all for steering me to the right direction.
pax
0
 
LVL 82

Expert Comment

by:Dave Baldwin
ID: 40347946
The only advantage of IDLE is the ability to run the code by pressing F5.  I'm using it because I'm just running a few demo programs to check things for people.  A 'real' editor like Notepad++ would be much better for 'real' programming.
0
 
LVL 2

Expert Comment

by:Nas-Banov
ID: 40348062
@cpeters5, if you are somewhat experienced programmer (i see you mentioned Perl), never mind other books or guides - i recommend you go with the Python Tutorial, https://docs.python.org/3.4/tutorial/index.html (version for 3.4, if so you like) - it is written by this guy), doesn't get any better than coming "straight from horse's mouth". Not only is he "The Guy" but he also writes in short, clear and understandable manner.

When i started with Python, i also looked for "the best book" on that and one i was told was "Dive into Python", that was almost ten years ago. My opinion of the book was "meh", it did not do it for me - i did not care about author's mini-projects and wherever he wanted to take me. Maybe it has improved over the years, dunno. But when i started reading "The PYthon Tutorial" - which is believe is only avail. online, it was much, much better. I was like "why would anybody want another book on the subject?"... it's like the best kept secret on a tutorial book.

Your experience might be different, maybe Pilgrim's fits you better than Guido's. My only strong feelings are against "Learn Python the hard way" by Zed Shaw - do not use that one. You have been warned.
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Plenty of writing has gone on the web trying to compare Python with other competitive programming languages and vice versa. However, not much has been put into a wholistic perspective. This article should help you decide whether to adopt Python as a…
Strings in Python are the set of characters that, once defined, cannot be changed by any other method like replace. Even if we use the replace method it still does not modify the original string that we use, but just copies the string and then modif…
Learn the basics of modules and packages in Python. Every Python file is a module, ending in the suffix: .py: Modules are a collection of functions and variables.: Packages are a collection of modules.: Module functions and variables are accessed us…
Learn the basics of while and for loops in Python.  while loops are used for testing while, or until, a condition is met: The structure of a while loop is as follows:     while <condition>:         do something         repeate: The break statement m…

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now