Python 3.4 mod wsgi get SyntaxError: invalid syntax \ r

When I run the following code, I get a syntax error:

def application(environ, start_response):

    result = ChildClass().getValue()
    status = '200 OK'
    output =  result

    response_headers = [('Content-type', 'text/plain'),
                        ('Content-Length', str(len(output)))]
    start_response(status, response_headers)

    print(output)
    return [output]

class ChildClass(): # define child class
   print('ppp')
   def __init__(self):
      print("Calling child constructor")

   def childMethod(self):
      print('Calling child method')
      #Parentclass().parentMethod()

   def getValue(self):
    # Open database connection
    db = mysql.connector.connect(user='root', password='55118',host='127.0.0.1',database='test')
    cursor = db.cursor()
    query = ("SELECT * from employees2")
    cursor.execute(query)
    #for (first_name) in cursor:
    return result = cursor.fetchall()

It does not accept return: return result = cursor.fetchall () \ r Syntax Error: invalid syntax \ r

0
source share

Source: https://habr.com/ru/post/1624654/


All Articles