Search code examples
pythondjangomod-wsgipython-requestsdjango-wsgi

Syntax Error in Python Request Library when Using on My Test server


I'm using Python Request Library in one of my projects. Everything works fine on my local system where I have Python 2.6 and Django 1.2.3.

I have created the same environment for my Test server(Python 2.6 and Django 1.2.3 and is using WSGI 3.2). Now I get some weird syntax errors. For example:

line 266
    result.append((k.encode('utf-8') if isinstance(k, unicode) else k,
                                      ^
SyntaxError: invalid syntax*

Here's another:

from .config import settings
      ^
SyntaxError: invalid syntax*

I'm guessing it's something because of wsgi but not sure exactly. Can someone please help me to solve this issue.

Thanks


Solution

  • I'm guessing your webserver (such as apache) is using an older version of python, rather than the python 2.6 environment you setup.