Python Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesPython Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old June 1st, 2004, 05:08 PM
oli oli is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 56 oli User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 54 m 13 sec
Reputation Power: 6
EOFError

Here's my program

Code:
short_factor = 1
long_factor = 2
rotat_factor = 3
try:
    type = raw_input ("Enter type of motor: (S/L/R)" )
except EOFError:
    print ('no input')


When I run it, I always got 'exceptions.EOFError' in the interactive window but it doesn't print 'no input', even though I did enter something.

Any idea what's wrong? Thanks.

Last edited by netytan : June 2nd, 2004 at 08:05 AM. Reason: Added Code tags

Reply With Quote
  #2  
Old June 1st, 2004, 08:34 PM
xlordt's Avatar
xlordt xlordt is offline
Only the strong survives!!.
Dev Shed God 1st Plane (5500 - 5999 posts)
 
Join Date: Feb 2003
Location: A World of wonders.
Posts: 5,547 xlordt User rank is Major (30000 - 40000 Reputation Level)xlordt User rank is Major (30000 - 40000 Reputation Level)xlordt User rank is Major (30000 - 40000 Reputation Level)xlordt User rank is Major (30000 - 40000 Reputation Level)xlordt User rank is Major (30000 - 40000 Reputation Level)xlordt User rank is Major (30000 - 40000 Reputation Level)xlordt User rank is Major (30000 - 40000 Reputation Level)xlordt User rank is Major (30000 - 40000 Reputation Level)xlordt User rank is Major (30000 - 40000 Reputation Level)xlordt User rank is Major (30000 - 40000 Reputation Level)  Folding Points: 109876 Folding Title: Super Ultimate Folder - Level 1Folding Points: 109876 Folding Title: Super Ultimate Folder - Level 1Folding Points: 109876 Folding Title: Super Ultimate Folder - Level 1Folding Points: 109876 Folding Title: Super Ultimate Folder - Level 1Folding Points: 109876 Folding Title: Super Ultimate Folder - Level 1Folding Points: 109876 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 1 Month 1 h 43 m 50 sec
Reputation Power: 378
Send a message via ICQ to xlordt Send a message via AIM to xlordt Send a message via MSN to xlordt Send a message via Yahoo to xlordt Send a message via Google Talk to xlordt Send a message via Skype to xlordt
Facebook MySpace
hm I just tried your program and i didnt get any error

Code:
short_factor = 1
long_factor = 2
rotat_factor = 3

try:
    type = raw_input ("Enter type of motor: (S/L/R)" )
    print type
except EOFError:
    print ('no input')

Reply With Quote
  #3  
Old June 2nd, 2004, 08:32 AM
oli oli is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 56 oli User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 54 m 13 sec
Reputation Power: 6
u are absolutely right. I didn't something else wrong in other part of my program. But now the thing is I don't get the the program to print 'no input' even if I enter nothing to the prompt.

I'm wondering if that is the right way to handle the EOFError exception.

Thanks.

Reply With Quote
  #4  
Old June 2nd, 2004, 09:07 AM
Strike Strike is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2001
Location: Houston, TX
Posts: 383 Strike User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 41 m 27 sec
Reputation Power: 7
Send a message via ICQ to Strike Send a message via AIM to Strike Send a message via Yahoo to Strike
Someone hitting enter during a raw_input() shouldn't raise an EOFError, it'd simply return "".
__________________
Debian - because life's too short for worrying.
Best. (Python.) IRC bot. ever.

Reply With Quote
  #5  
Old June 2nd, 2004, 10:32 AM
xlordt's Avatar
xlordt xlordt is offline
Only the strong survives!!.
Dev Shed God 1st Plane (5500 - 5999 posts)
 
Join Date: Feb 2003
Location: A World of wonders.
Posts: 5,547 xlordt User rank is Major (30000 - 40000 Reputation Level)xlordt User rank is Major (30000 - 40000 Reputation Level)xlordt User rank is Major (30000 - 40000 Reputation Level)xlordt User rank is Major (30000 - 40000 Reputation Level)xlordt User rank is Major (30000 - 40000 Reputation Level)xlordt User rank is Major (30000 - 40000 Reputation Level)xlordt User rank is Major (30000 - 40000 Reputation Level)xlordt User rank is Major (30000 - 40000 Reputation Level)xlordt User rank is Major (30000 - 40000 Reputation Level)xlordt User rank is Major (30000 - 40000 Reputation Level)  Folding Points: 109876 Folding Title: Super Ultimate Folder - Level 1Folding Points: 109876 Folding Title: Super Ultimate Folder - Level 1Folding Points: 109876 Folding Title: Super Ultimate Folder - Level 1Folding Points: 109876 Folding Title: Super Ultimate Folder - Level 1Folding Points: 109876 Folding Title: Super Ultimate Folder - Level 1Folding Points: 109876 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 1 Month 1 h 43 m 50 sec
Reputation Power: 378
Send a message via ICQ to xlordt Send a message via AIM to xlordt Send a message via MSN to xlordt Send a message via Yahoo to xlordt Send a message via Google Talk to xlordt Send a message via Skype to xlordt
Facebook MySpace
Quote:
Originally Posted by oli
u are absolutely right. I didn't something else wrong in other part of my program. But now the thing is I don't get the the program to print 'no input' even if I enter nothing to the prompt.

I'm wondering if that is the right way to handle the EOFError exception.

Thanks.


If you want the program to output ( no input ) then you need to add an if statement for that.. should work for ya

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPython Programming > EOFError


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
Stay green...Green IT