2013-07-13 139 views
0

我試圖在CentOS安裝「mod_pywebsocket」 5.9 32位,本指南「https://code.google.com/p/websocket-sample/wiki/HowToInstallMod_pywebsocket蟒蛇的setup.py安裝語法錯誤:無效的語法926

以下,但用命令「sudo的蟒蛇的setup.py安裝「我看到一個錯誤:

[[email protected] src]# python setup.py install 
running install 
running build 
running build_py 
running install_lib 
byte-compiling /usr/lib/python2.4/site-packages/mod_pywebsocket/mux.py to mux.pyc 
    File "/usr/lib/python2.4/site-packages/mod_pywebsocket/mux.py", line 926 
    finally: 
     ^
SyntaxError: invalid syntax 
[[email protected] src]# 

這裏的一些行 」mux.py「 文件:

916 Writing data will block the worker so we need to release 
       # _send_condition before writing. 
       self._logger.debug('Sending inner frame: %r' % inner_frame) 
       self._request.connection.write(inner_frame) 
       write_position += write_length 

       opcode = common.OPCODE_CONTINUATION 

     except ValueError, e: 
      raise BadOperationException(e) 
926  finally: 
      self._write_inner_frame_semaphore.release() 

    def replenish_send_quota(self, send_quota): 
     """Replenish send quota.""" 

     try: 
      self._send_condition.acquire() 
      if self._send_quota + send_quota > 0x7FFFFFFFFFFFFFFF: 
       self._send_quota = 0 
       raise LogicalChannelError(

是什麼意思?我必須做什麼?

回答

0

問題是mux.py中使用的語法在Python 2.4中不起作用。在當前Python 2 Language Reference指出:

Changed in version 2.5: In previous versions of Python, try...except...finally did not work. try...except had to be nested in try...finally .

我的猜測是,在這裏mod_pywebsockets代碼已經改變,因爲HowTo是與Python 2.4 CentOS上上次測試。您可以考慮修補代碼以避免try...except...finally或通過mod_pywebsockets代碼回購來搜索早期版本,該版本可以與Python 2.4兼容,或者您​​可以安裝並使用更新版本的Python 2(Python 2.7.5是最新版本)和系統Python 2.4一起。