![]() |
| ||
| Trouble with a certain Exception Hello everyone! I haven't programmed in quite a while and now that I'm getting back into the programming environment for my robotics project again, I'm a little stumped on something: I'm getting this error message for an exception raised in my VAST python script for my robot. It goes like this: Quote:
What stumps me is when I go to line 456, I only see this: Quote:
I went back to Health2, but didn't see anything on DateTime_GetNumberOfDaysinYear, there. I even did a find for the phrase in my scripts, but it says it can't find it. I brushed up on my python books, but can't isolate the problem. If someone could give me any help with this, I'd be obliged. Thanks in advance. |
| ||
| Re: Trouble with a certain Exception 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: >>> import wx If you get the right result, then the bug's in Speak(). If not, then you should (re?)install wx. Jeff |
| ||
| Re: Trouble with a certain Exception Hello again, Jeff! I test the wxPython install like you said and got the result as you indicated, so its no wxPython. I think I've isolated the problem to somewhere much earlier in my program: Quote:
I tried typing this in the command prompt and it gave back this result: Quote:
If I understand correctly, the package I just installed isn't good anymore, so I need to switch to the "wx" package? Where can I find that? |
| ||
| Re: Trouble with a certain Exception Okay, I think I found the answer to that. All I had to do was change, say wxbitmap to wx.bitmap, in my script. But now I'm getting something else. When I try running the script, I get this error message: Quote:
I first thought this had something to do with the SAPI SDK 5.1 not being install on my New computer (my old laptop suffered a spill, so that's why I'm having trouble getting this script to work again on my new one). But apparently, after reinstalling it, I get the same message. Could it be that the python win32 extention isn't installed on my laptop? Because I thought I installed it... |
| ||
| Re: Trouble with a certain Exception I believe the bug is indeed, in speaker.Speak(). I tried retyping the script in the comman line to see step by step what was working and what was going through. The moment I finished typing in Quote:
Quote:
I only have a rough idea of whats happening in the computer as far as coding is concerned, so I'm not sure how to fix this problem... |
| ||
| Re: Trouble with a certain Exception And I have no knowledge at all of the Voice Recognition module... :lol: This error is saying something interesting: Quote:
Apparently, it is defining a class that inherits from the result of the call to win32com.client.getevents("SAPI.SpSharedRecoContext") I've not heard of dynamic inheritance before, but it makes sense that Python could do it! I was able to reproduce the bug like this: class MyClass(eval(raw_input("Enter a Class: "))):
So apparently, win32com.client.getevents("SAPI.SpSharedRecoContext") is returning None when it ought to return some class name. Can you find anything out about that? Jeff |
| ||
| Re: Trouble with a certain Exception Hi Jeff. I think my problem was I hadn't used the MakePy Windows speech Object Library on it, because it got rid of that error. Now I'm getting something else, much farther down the script: Quote:
From what I understand, 'true' is a type of switch or property. It should work in any python script without importing or fancy defining or anything like that. Here's the chunk of code that seems to be affected: Quote:
Its part of a class called "MyApp(wx.App):" which is extremely vast with the lists of phrases my robot responds to. Any ideas? I think we're both sort of exploring this speech recognition python territory. I'll keep investigating on my own as well. |
| ||
| Re: Trouble with a certain Exception 'True', not 'true'. It should turn purple when spelled correctly. |
| ||
| Re: Trouble with a certain Exception 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: Quote:
Here's the chunk of code that seems to be affected. Quote:
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 |
| ||
| Re: Trouble with a certain Exception Yes, it's a bug that was clearly written by a C++ coder who has migrated to Python. The first argument to wx.Frame() is its parent, which should be None in a typical case. In C++, the corresponding value would be NULL. So if you change NULL to None, it oughta work (up to the next exception :) ) Jeff |
| All times are GMT -4. The time now is 8:41 pm. |
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC