User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Python section within the Software Development category of DaniWeb, a massive community of 374,163 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,259 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Python advertiser:

Trouble with a certain Exception

Join Date: Jul 2006
Posts: 562
Reputation: jrcagle is on a distinguished road 
Rep Power: 4
Solved Threads: 71
jrcagle jrcagle is offline Offline
Posting Pro

Re: Trouble with a certain Exception

  #2  
May 4th, 2008
My money's on a bug in speaker.Speak() OR on an improperly installed wxPython module. Here's why:

Your line chooses a random item from Health2, which is presumed to be a list.

If Health2 is not a list, then random.choice throws a TypeError, which is not your issue.

Further, random.choice() is a well-tested function that couldn't possibly throw the error you're getting. So ... that leaves speaker.Speak() as the source of the error.

Next task: identify the class of "speaker", and check out the code for its Speak() method.

It looks like from the first line of your Traceback that speaker.Speak() tries to import wxPython and do something fancy from there.

Here's how to test for a problem with your wxPython install:

From the command line of IDLE:

  1. >>> import wx
  2. >>> e = wx.DateTime()
  3. >>> e.GetNumberOfDaysInYear(2008)
  4. 366

If you get the right result, then the bug's in Speak(). If not, then you should (re?)install wx.

Jeff
Reply With Quote  
All times are GMT -4. The time now is 3:51 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC