Def main () Invalid syntax, Dev server and terminal

From terminal:

File "index.py", line 41
def main():
  ^ SyntaxError: invalid syntax

From the App Engine Developer Server. I am running 2.7.3rc2 on Debian:

msg = 'invalid syntax'
      offset = 3
      print_file_and_line = None
      text = 'def main():\n'

Script:

def main():   # << here
    run_wsgi_app(application)

if __name__=="__main__":
    main()
+5
source share
1 answer

This error is probably caused by a syntax error above in the code, for example, the lack of a close password.

For example, the following code will give SyntaxError in the same place as your code:

(
def main():
    pass

If it's hard for you to keep track of this, submit the code that comes earlier.

+13
source

All Articles