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,616 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 2,281 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: Aug 2007
Posts: 32
Reputation: Seagull One is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 0
Seagull One Seagull One is offline Offline
Light Poster

Re: Trouble with a certain Exception

  #9  
May 9th, 2008
Oh, right. Thanks, Jeff! That solved that problem.

Now when I run the script, the windows speed recognition activates! Theres another exception that comes up though, but since the windows speech recognition comes up just before the exception, I know we're getting close.

Here's whats coming up now:

Setting words - turned on
Traceback (most recent call last):
File "C:\Python25\Lib\site-packages\pythonwin\pywin\framework\scriptutils.py", line 310, in RunScript
exec codeObject in __main__.__dict__
File "C:\Users\Loren\Desktop\My Robots\Nina Verbal Raw Input.py", line 674, in <module>
app = MyApp(0)
File "C:\Python25\lib\site-packages\wx-2.8-msw-unicode\wx\_core.py", line 7836, in __init__
self._BootstrapApp()
File "C:\Python25\lib\site-packages\wx-2.8-msw-unicode\wx\_core.py", line 7433, in _BootstrapApp
return _core_.PyApp__BootstrapApp(*args, **kwargs)
File "C:\Users\Loren\Desktop\My Robots\Nina Verbal Raw Input.py", line 553, in OnInit
self.frame = wx.Frame(NULL, -1, "Speech tester", wx.Point(10,10), wx.Size(770,300))
NameError: global name 'NULL' is not defined

Here's the chunk of code that seems to be affected.

def OnInit(self):
self.setItems()
self.InitSpeech()

self.frame = wx.Frame(NULL, -1, "Speech tester", wx.Point(10,10), wx.Size(770,300))
self.listBox = wx.ListBox(self.frame, self.LISTBOX_ID, wx.Point(10, 10), wx.Size(120, 200),
self.items.keys(), wx.LB_SINGLE)
self.addButton = wx.Button(self.frame, self.ADD_BUTTON_ID, "Add", wx.Point(10,230), wx.Size(50, 30))
self.deleteButton = wx.Button(self.frame, self.DELETE_BUTTON_ID, "Delete", wx.Point(80, 230), wx.Size(50, 30))
self.editor = wx.TextCtrl(self.frame, self.EDITOR_ID, "", wx.Point(140,10), wx.Size(600,200),
style=wx.SUNKEN_BORDER+wx.TE_MULTILINE+wx.TE_PROCESS_TAB)
self.testButton = wx.Button(self.frame, self.TEST_BUTTON_ID, "Test", wx.Point(140, 230), wx.Size(50, 30))

self.turnonButton = wx.Button(self.frame, self.TURNON_BUTTON_ID, "On", wx.Point(210, 230), wx.Size(50, 30))
self.turnoffButton = wx.Button(self.frame, self.TURNOFF_BUTTON_ID, "Off", wx.Point(280, 230), wx.Size(50, 30))

self.SetUpTaskbar()

EVT_LISTBOX(self, self.LISTBOX_ID, self.OnListBoxSelect)
EVT_BUTTON(self, self.ADD_BUTTON_ID, self.OnAddClick)
EVT_BUTTON(self, self.DELETE_BUTTON_ID, self.OnDeleteClick)
EVT_BUTTON(self, self.TEST_BUTTON_ID, self.OnTestClick)
EVT_BUTTON(self, self.TURNON_BUTTON_ID, self.OnTurnOnClick)
EVT_BUTTON(self, self.TURNOFF_BUTTON_ID, self.OnTurnOffClick)
EVT_TEXT(self, self.EDITOR_ID, self.OnTextEntered)

EVT_ICONIZE(self.frame, self.OnIconize)
EVT_CLOSE(self.frame, self.OnExitFrame)

self.listBox.SetSelection(0)
self.displayTextBox()

self.frame.Show(True)
self.SetTopWindow(self.frame)
return True

Once again, I'm not sure how that works. Isn't NULL an expression you can use without defining it? I think that might be typed incorrectly, like with 'true,' but I'm not sure how to fix it. You know what's going on? I'll hit the books in the meantime.

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