Indentation issues with python
Denis McMahon
denismfmcmahon at gmail.com
Thu Feb 5 06:46:05 EST 2015
On Wed, 04 Feb 2015 19:07:53 -0800, syed khalid wrote:
> I downloaded this code and am attempting to run it. I keep getting
> indentation error.
> class EventHubClient(object):
> def sendMessage(self,body,partition):eventHubHost =
> "pac-ns.servicebus.windows.net"
> httpclient = _HTTPClient(service_instance=self)
> def sendMessage(self,body,partition):
> ^
> IndentationError: expected an indented block
> ***********************************************************************
> sasKeyName = "SendPolicy"
> sasKeyValue = "erENqf/5wdWCNEbCA9NsDIRqd5MRKdkii07+wezl/NU="
class starts a class definition. def starts a function (or method)
definition. The parser expects these definitions to be followed by one or
more indented lines being the code of the class or function (method).
The following lines down to either a return or the next function
definition line should probably all be indented.
eg:
class EventHubClient(object):
def sendMessage(self,body,partition):
eventHubHost = "pac-ns.servicebus.windows.net"
httpclient = _HTTPClient(service_instance=self)
sasKeyName = "SendPolicy"
sasKeyValue = "erENqf/5wdWCNEbCA9NsDIRqd5MRKdkii07+wezl/NU="
...... more indented code should probably follow
Getting the indentation correct is absolutely critical in Python.
--
Denis McMahon, denismfmcmahon at gmail.com
More information about the Python-list
mailing list