Similar situation can happen when you try to access admin page through 
simple http protocol over network. Web2py will raise exception and we got 
that error:

TypeError: sequence of byte string values expected, value of type str found

Code responsible for that error is:

if request.is_https:
    session.secure()
elif (remote_addr not in hosts) and (remote_addr != "127.0.0.1") and \
    (request.function != 'manage'):
    raise HTTP(200, T('appadmin is disabled because insecure channel'))

One solution is to erase all of this and just put session.secure() but this 
is not good idea and can be use only for testing.

Source of problem is combination of T() and HTTP() helper. In production I 
just remove T() helper like this:

raise HTTP(200, 'appadmin is disabled because insecure channel')

and that solve my problem. Maybe someone have beter solution for that 
problem?

Of course, this will happen in all situation when web2py raise HTTP() with 
T() as argument. So to avoid that I just use string as argument without T() 
helper.

On Friday, December 7, 2018 at 2:50:16 PM UTC+1, Carl Petersen wrote:
>
> Hello,
>
> I'm having a similar issue.  I'm using Python 3.6.6, mod_wsgi 4.6.5, 
> Apache 2.4.6 with web2py 2.17.2.
>
> I can get to the welcome screen, but as soon as I try to access the admin 
> application I get the following on my screen:
>
> Internal Server Error
>
> The server encountered an internal error or misconfiguration and was 
> unable to complete your request.
>
> Please contact the server administrator at root@localhost to inform them 
> of the time this error occurred, and the actions you performed just before 
> this error.
>
> More information about this error may be available in the server error log.
>
>
> And this in my apache error_log:
>
>  [Fri Dec 07 08:32:14.626246 2018] [mpm_prefork:notice] [pid 30005] 
> AH00163: Apache/2.4.6 (Red Hat Enterprise Linux) OpenSSL/1.0.2k-fips 
> mod_wsgi/4.6.5 Python/3.6 configured -- resuming normal operations
>
> [Fri Dec 07 08:32:33.572686 2018] [wsgi:error] [pid 30007] [remote 
> 10.20.100.133:56416] mod_wsgi (pid=30007): Exception occurred processing 
> WSGI script '/opt/web-apps/web2py/wsgihandler.py'.
>
> [Fri Dec 07 08:32:33.572836 2018] [wsgi:error] [pid 30007] [remote 
> 10.20.100.133:56416] TypeError: sequence of byte string values expected, 
> value of type str found
>
> Any assistance would be greatly appreciated.
>
>
>
> On Sunday, September 2, 2018 at 1:03:30 PM UTC-5, motionbutterfly wrote:
>>
>> Hello, I was wondering if anyone here could help me. I've been migrating 
>> a web2py application from Python2.7 to Python3.4, this application was 
>> already being hosted in a webserver with Apache2.4 following the steps in 
>> the Deployment Recipes chapter of the web2py book. I reconfigured apache to 
>> run with python 3, and reinstalled mod_wsgi using pip. My problem is that 
>> as soon as I load my application I get an internal error, and when I click 
>> on the ticket it shows me "500 Internal Server Error", and when I look up 
>> the error log for apache this is what comes up: 
>>
>> [Thu Aug 23 22:42:17.748139 2018] [wsgi:warn] [pid 2268:tid 
>> 139927378876288] mod_wsgi: Compiled for Python/3.4.2rc1+.
>> [Thu Aug 23 22:42:17.748154 2018] [wsgi:warn] [pid 2268:tid 
>> 139927378876288] mod_wsgi: Runtime using Python/3.4.2.
>> [Thu Aug 23 22:42:17.896498 2018] [mpm_event:notice] [pid 2268:tid 
>> 139927378876288] AH00489: Apache/2.4.10 (Debian) OpenSSL/1.0.1t 
>> mod_wsgi/4.3.0 Python/3.4.2 mod_perl/2.0.9dev Perl/v5.20.2 configured -- 
>> resuming normal operations
>> [Thu Aug 23 22:42:17.896584 2018] [core:notice] [pid 2268:tid 
>> 139927378876288] AH00094: Command line: '/usr/sbin/apache2'
>> [Thu Aug 23 22:45:29.528373 2018] [wsgi:error] [pid 2272:tid 
>> 139927187830528] <class 'int'>
>> [Thu Aug 23 22:45:29.528468 2018] [wsgi:error] [pid 2272:tid 
>> 139927187830528] 10
>> [Thu Aug 23 22:45:29.968522 2018] [wsgi:error] [pid 2272:tid 
>> 139927213033216] Loads pas\xc3\xb3
>> [Thu Aug 23 22:45:35.289112 2018] [wsgi:error] [pid 2272:tid 
>> 139927179421440] [remote 186.89.23.145:25178] mod_wsgi (pid=2272): 
>> Exception occurred processing WSGI script 
>> '/home/www-data/web2py/wsgihandler.py'.
>> [Thu Aug 23 22:45:35.289293 2018] [wsgi:error] [pid 2272:tid 
>> 139927179421440] [remote 186.89.23.145:25178] TypeError: sequence of 
>> byte string values expected, value of type str found
>>
>> Which seems to suggest that the problem is inside the wsgihandler.py 
>> script, but doesn't point out where. Has this happened to anyone else 
>> before?
>>
>> Thanks in advance for any help.
>>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to