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 363,489 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,410 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: 554
Reputation: jrcagle is on a distinguished road 
Rep Power: 3
Solved Threads: 69
jrcagle jrcagle is offline Offline
Posting Pro

Re: Trouble with a certain Exception

  #6  
May 8th, 2008
And I have no knowledge at all of the Voice Recognition module... :lol:

This error is saying something interesting:

class ContextEvents(win32com.client.getevents("SAPI.SpSharedRecoContext")):
TypeError: Error when calling the metaclass bases
cannot create 'NoneType' instances

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:

  1. class MyClass(eval(raw_input("Enter a Class: "))):
  2. pass
  3. >>> Enter a Class: object
  4. >>> m = MyClass()
  5. >>> print m
  6. <__main__.MyClass object at 0x00BFB250>
  7.  
  8. ---
  9.  
  10. >>>
  11. Enter a Class: str
  12. >>> m = MyClass()
  13. >>> print m
  14.  
  15. >>> m
  16. ''
  17. >>>
  18.  
  19. ---
  20.  
  21. >>> Enter a Class: None
  22. >>> m = MyClass()
  23. Traceback (most recent call last):
  24. File "C:/Python25/dyninherit.py", line 1, in <module>
  25. class MyClass(eval(raw_input("Enter a Class"))):
  26. TypeError: Error when calling the metaclass bases
  27. cannot create 'NoneType' instances

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
Reply With Quote  
All times are GMT -4. The time now is 3:33 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC