简体   繁体   中英

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

This errors mean that actually you are not using Python 2.6. Probably Python 2.4 is also installed on you environment and it is used to execute your code.

我猜您的网络服务器(例如apache)使用的是python的旧版本,而不是您设置的python 2.6环境。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM