2013-10-01 36 views
0

我已經通過進口的CherryPy如何在cherrypy中設置會話中的值以及如何獲取該值?

cherrypy.session['otp_status']=1 

創建一個會話,如下但是當我嘗試找回它爲以下

otp_status=cherrypy.session['otp_status'] 

它顯示

KeyError: 'otp_status' 

如何獲得來自會議的價值?

+0

'cherrypy.session [ 'otp_status'] == 1'是一個比較,不分配。 – Cthulhu

+0

您確定沒有輸入'cherrypy.session ['otp_status'] = 1'嗎? –

+1

@Cthulhu我已經更新了這個問題。我正在嘗試從另一個python文件中檢索會話值。 KeyError:'otp_status'發生在那裏。 –

回答

相關問題