w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Pass Variable Between classes in python, (AttributeError: 'NoneType' object has no attribute 'write')

You need to look at the signature of classes based on webapp2.RequestHandler ( specifically the init method)

From the docs http://webapp-improved.appspot.com/api/webapp2.html#webapp2.RequestHandler we get

 class webapp2.RequestHandler(request=None,
response=None)[source]

So when you instantiate an instance of a class inheriting from RequestHandler you need to initialise it correctly.

You code should read

 classname = questAnsweredPage(self.request,self.response)

Now why you would use a variable name classname to hold an instance of a class is a whole separate style issue ;-)





© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.