Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Jul 10, 2013, 11:09 AM   #1
turboLT
macrumors newbie
 
Join Date: Jul 2013
IDLE hangs on raw_input()

Hi All,

On my wife's 2012 Macbook Air I'm trying to finish up a python problem set, but every time I run a script it IDLE hangs on raw_input().

At first I thought it was me, but I used the professor's solution and that hung too.

Ex:
number = float(raw_input("Enter a number: "))
print number

will output in IDLE:

Enter a number:

then just spinning pinwheel and no way to enter anything. Thoughts?
thanks in advance for your help!
turboLT is offline   0 Reply With Quote
Old Jul 10, 2013, 11:25 AM   #2
subsonix
macrumors 68030
 
Join Date: Feb 2008
It seems like you are leaving out some crucial details here. I tried what you posted in the Python live interpreter and had no issues with it.
subsonix is offline   0 Reply With Quote
Old Jul 10, 2013, 11:36 AM   #3
turboLT
Thread Starter
macrumors newbie
 
Join Date: Jul 2013
Ill happily supply anything relevant. I can't figure it out either - the same code worked for me on a 2008 MacBook until it died last weekend. Ill post the python version momentarily
turboLT is offline   0 Reply With Quote
Old Jul 10, 2013, 11:44 AM   #4
ArtOfWarfare
macrumors 603
 
ArtOfWarfare's Avatar
 
Join Date: Nov 2007
Send a message via Skype™ to ArtOfWarfare
Learn Python the Hard Way mentions that IDLE hangs on raw_input() and advises against using it (or any other IDE.)
__________________
Don't tell me Macs don't last: 2007 iMac, 2007 Mac Mini, 2008 MacBook Air, all Vintage.
(iMac obsoletion: April 28, 2015, MBA: October 14, 2015, Mac Mini: March 9, 2016)
ArtOfWarfare is offline   0 Reply With Quote
Old Jul 10, 2013, 11:46 AM   #5
turboLT
Thread Starter
macrumors newbie
 
Join Date: Jul 2013
Python 2.7.2 on OSX 10.8.3

----------

Interesting re the hanging. The MIT class says to only use raw_input() so I wonder if I should just convert it all to input()? Doesn't input() mean something different in python 3.x?
turboLT is offline   0 Reply With Quote
Old Jul 10, 2013, 11:48 AM   #6
subsonix
macrumors 68030
 
Join Date: Feb 2008
Quote:
Originally Posted by ArtOfWarfare View Post
Learn Python the Hard Way mentions that IDLE hangs on raw_input() and advises against using it (or any other IDE.)
Wow, that sucks.

FWIW I interpreted "idle" in it's litteral meaning here, lol.
subsonix is offline   0 Reply With Quote
Old Jul 10, 2013, 12:01 PM   #7
turboLT
Thread Starter
macrumors newbie
 
Join Date: Jul 2013
So if you're not supposed to use IDLE what does learn python the hard way recommend? Please bear with me as I'm super new to Python.

----------

After google searches I'm guessing people are just using terminal?
turboLT is offline   0 Reply With Quote
Old Jul 10, 2013, 12:03 PM   #8
ArtOfWarfare
macrumors 603
 
ArtOfWarfare's Avatar
 
Join Date: Nov 2007
Send a message via Skype™ to ArtOfWarfare
Quote:
Originally Posted by turboLT View Post
So if you're not supposed to use IDLE what does learn python the hard way recommend? Please bear with me as I'm super new to Python.
A text editor and terminal. I enjoy the Sublime text editor, personally, which is available as a free download here:

http://www.sublimetext.com/2

The free trial version has no limitations at all, other than the fact it'll occasionally (about once a month) remind you of the fact that you haven't paid yet. It's $70 if you feel compelled to buy it, but there's no need to.

The idea behind this text editor and terminal approach when learning is to help the learner understand what is and isn't necessary to program, as well as what IDEs provide.

IE, many beginners learning C/Obj-C/C++ on the Mac think that their source code is in some kind of magic file that only Xcode can open and that only Xcode can run. It's not. It's in a text file, you can compile and link it without Xcode, and you can run it however you please.
__________________
Don't tell me Macs don't last: 2007 iMac, 2007 Mac Mini, 2008 MacBook Air, all Vintage.
(iMac obsoletion: April 28, 2015, MBA: October 14, 2015, Mac Mini: March 9, 2016)
ArtOfWarfare is offline   0 Reply With Quote
Old Jul 10, 2013, 12:14 PM   #9
turboLT
Thread Starter
macrumors newbie
 
Join Date: Jul 2013
That's fantastic advice, thank you! I'm excited to get back to it.
turboLT is offline   0 Reply With Quote
Old Jul 16, 2013, 11:23 PM   #10
SJHKMan
macrumors newbie
 
Join Date: May 2011
Location: San Jose
My son just encountered the same problem. Looked up the web and found that it's a known problem. The trick is not to use the F5 button to run but select the Run menu and click Run Module instead.
SJHKMan is offline   0 Reply With Quote
Old Oct 9, 2013, 08:42 AM   #11
WorkingMatt
macrumors newbie
 
Join Date: Oct 2013
Fix for IDLE broken on Mac

ArtOfWarfare was quite right about IDLE not working on Macs - at least an out of the box Mac.

IDLE relies on Tcl/Tk to run and Apple's standard version 8.5 is a bit knackered. So if you need to run python, write your code in a text editor (+1 for Sublime!) and execute it in Terminal thus: python filename.py

You can also fix the problem with the latest version of Python that comes with Tcl/Tk. Here's my blogpost explaining this: http://bit.ly/17W76Ks
WorkingMatt is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
Restarting when idle! please help beerunner MacBook Pro 0 Nov 8, 2013 10:08 PM
Idle Speculation (2014) badman89 MacBook Air 3 Jan 6, 2013 07:38 AM
MBPr idle temps. andrewmchugh MacBook Pro 8 Oct 7, 2012 11:58 AM
iPhone 4S battery when idle andrewfx iPhone Tips, Help and Troubleshooting 7 Sep 7, 2012 10:27 AM
How to prevent idle sleep BigZ9 Mac Programming 4 Aug 8, 2012 06:55 PM

Forum Jump

All times are GMT -5. The time now is 04:05 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC