Strange Session Key issue re-emerges

75 views
Skip to first unread message

Kevin Keller

unread,
Jun 16, 2021, 4:35:03 AM6/16/21
to py4web
Other users have reported the same issue, strangely it seems to run fine on Linux but not on Mac. 


Maybe something goes wrong dong the creation of the session key in the file system?

Anyhow, it is not only the _dasbhoard, but any app that wants to use session that does not work now, rendering py4web defunct atm. 


Alexander Beskopilny

unread,
Jun 16, 2021, 6:04:38 AM6/16/21
to py4web
line 1634, in set_cookie
raise TypeError('Secret key missing for non-string Cookie.')
TypeError: Secret key missing for non-string Cookie.
---------------------------------------------------------------------------------
I had that a week ago on Centos7.
The problem disappeared after reinstalling venv and 
git clone py4web && pip install -r requirements

Kevin Keller

unread,
Jun 16, 2021, 6:17:43 AM6/16/21
to Alexander Beskopilny, py4web
nice that solves it. 

I suppose there is still an old session key file lingering somewhere in some service_folder?

I suppose if we were able to find the folder path and delete it from the global python installation that would also solve it. 

But installing a virtual environment is best practice anyway, so I am happy with this. 

Thanks Alex !

--
You received this message because you are subscribed to the Google Groups "py4web" group.
To unsubscribe from this group and stop receiving emails from it, send an email to py4web+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/py4web/077a9795-d6e6-4fe6-9fa2-9c567c64f997n%40googlegroups.com.

Alexander Beskopilny

unread,
Jun 16, 2021, 7:18:28 AM6/16/21
to py4web

Kevin Keller

unread,
Jun 16, 2021, 7:48:04 AM6/16/21
to Alexander Beskopilny, py4web
Very interesting. 

I guess it works as designed, it is probably hard to encrypt non-string data reliably in a framework. 

One to watch out for. 

I guess we can fix this in our code by wrapping cookie_data into a string:

str(cookie_data) 

?

Like so:

response.set_cookie(
self.local.session_cookie_name,
str(cookie_data),
path="/",
secure=self.local.secure,
same_site=self.same_site,
)


Kevin Keller

unread,
Jun 16, 2021, 8:07:36 AM6/16/21
to Alexander Beskopilny, py4web
This seems to fix it indeed..


Reply all
Reply to author
Forward
0 new messages