[wingide-users] Problem with inclusion of rtn

Wingware Support support at wingware.com
Thu Jun 21 13:57:11 MDT 2007


Max Slimmer wrote:
> I am trying to use a routine that maskarades as a module, this code was
> gleaned from python cookbook see below.  After the include for this module I
> get the error:

This appears to be a bug in Wing's debugger.  A workaround is to add a 
__name__ attribute to the class as follows:

class _const:
	__name__ = globals().get('__name__')
	class ConstError(TypeError): pass

	def __setattr__(self,name,value):
		if not self.__dict__.has_key('debug') and
self.__dict__.has_key(name):
			raise self.ConstError, "Can't rebind const(%s)"%name
		self.__dict__[name]=value

	def __delattr__(self,name) :
		del self.__dict__[name]

import sys
sys.modules[__name__]=_const()

Of course, the bug in Wing should be fixed and we will try to do so in 
an upcoming release.

Thanks for the bug report.

John


More information about the wingide-users mailing list