[web2py] Re: Problem with wsgihandler.py Apache/Python3

2020-11-06 Thread Andrew Rogers
This still seems like a problem. In my case I had forgotten to create a 
password after installing web2py on Debian. I assume it was throwing an 
error on:

raise HTTP(200, T('admin disabled because no admin password'))

After I created a password this error went away:

*Internal Server Error*
*The server encountered an internal error or misconfiguration and was 
unable to complete your request.*

Configuring a password is done by running the following code from the 
web2py folder.

sudo -u www-data python -c "from gluon.main import save_password; 
save_password(input('admin password: '), 443)"


On Monday, 31 December 2018 at 07:49:19 UTC+10 Massimo Di Pierro wrote:

> This looks correct. Can you please submit a PR?
>
>
> On Friday, 7 December 2018 07:47:00 UTC-8, Carl Petersen wrote:
>>
>> I was able to get web2py up and running by changing the following line 
>> (131) in http.py  I don't expect that this was the proper way to do it 
>> (especially considering backward compatibility), but at lease it might 
>> point out where the issue is:
>>
>> elif isinstance(body, (str, bytes, bytearray)):
>>  if isinstance(body, unicodeT):
>>  body = to_bytes(body)
>>  return [body]
>> elif hasattr(body, '__iter__'):
>> return [x.encode('utf-8') for x in body]  - Changed from  
>> "return body"
>> else:
>> body = str(body)
>> if isinstance(body, unicodeT):
>> body = to_bytes(body)
>> return [body]
>>  
>> I didn't know whether I should just apply to_bytes(body) like the other 
>> returns because the other returns were coded "return [body]" instead of 
>> "return body".
>>
>> Thanks
>>
>> On Friday, December 7, 2018 at 7:50:16 AM UTC-6, 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] 
 [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 
 

[web2py] Re: Problem with wsgihandler.py Apache/Python3

2018-12-30 Thread Massimo Di Pierro
This looks correct. Can you please submit a PR?

On Friday, 7 December 2018 07:47:00 UTC-8, Carl Petersen wrote:
>
> I was able to get web2py up and running by changing the following line 
> (131) in http.py  I don't expect that this was the proper way to do it 
> (especially considering backward compatibility), but at lease it might 
> point out where the issue is:
>
> elif isinstance(body, (str, bytes, bytearray)):
>  if isinstance(body, unicodeT):
>  body = to_bytes(body)
>  return [body]
> elif hasattr(body, '__iter__'):
> return [x.encode('utf-8') for x in body]  - Changed from  
> "return body"
> else:
> body = str(body)
> if isinstance(body, unicodeT):
> body = to_bytes(body)
> return [body]
>  
> I didn't know whether I should just apply to_bytes(body) like the other 
> returns because the other returns were coded "return [body]" instead of 
> "return body".
>
> Thanks
>
> On Friday, December 7, 2018 at 7:50:16 AM UTC-6, 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] 
>>> [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 

[web2py] Re: Problem with wsgihandler.py Apache/Python3

2018-12-08 Thread Peter
In my environment this work. Of course, after that you should enable admin 
through http or configure https. This correction only enable to see what is 
problem.

web2py/applications/admin/models/access.py


# original code
elif not request.is_local and not DEMO_MODE:
raise HTTP(200, T('Admin is disabled because insecure channel'))


# corrected
elif not request.is_local and not DEMO_MODE:
raise HTTP(200, 'Admin is disabled because insecure channel')



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] 
>> [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.


[web2py] Re: Problem with wsgihandler.py Apache/Python3

2018-12-08 Thread Peter
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] 
>> [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 

[web2py] Re: Problem with wsgihandler.py Apache/Python3

2018-12-07 Thread Carl Petersen
I was able to get web2py up and running by changing the following line 
(131) in http.py  I don't expect that this was the proper way to do it 
(especially considering backward compatibility), but at lease it might 
point out where the issue is:

elif isinstance(body, (str, bytes, bytearray)):
 if isinstance(body, unicodeT):
 body = to_bytes(body)
 return [body]
elif hasattr(body, '__iter__'):
return [x.encode('utf-8') for x in body]  - Changed from  
"return body"
else:
body = str(body)
if isinstance(body, unicodeT):
body = to_bytes(body)
return [body]
 
I didn't know whether I should just apply to_bytes(body) like the other 
returns because the other returns were coded "return [body]" instead of 
"return body".

Thanks

On Friday, December 7, 2018 at 7:50:16 AM UTC-6, 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] 
>> [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.


[web2py] Re: Problem with wsgihandler.py Apache/Python3

2018-12-07 Thread Carl Petersen
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] 
> [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.


[web2py] Re: Problem with wsgihandler.py Apache/Python3

2018-11-20 Thread Peter
Check if you have in your application in file appadmin.py code:
try:
  ...
except Exception, e:
  ...

except Exception, e: is python 2 and should be changed to:

except Exception as e:


On Sunday, November 18, 2018 at 7:46:35 PM UTC+1, Dave wrote:
>
> I'm having the same troubles after upgrading to python3 using Apache 
> with libapache2-mod-wsgi-py3 4.5.17-1 on Ubuntu.
>
> I did delete all session files, and I am using fresh source code of web2py 
> (R-2.17.2).
>
> I'm running several applications in web2py, and when i restart Apache they 
> work for a while. Then at some point later, and I haven't figured out what 
> initiates the problem, I am getting:
>
> Traceback (most recent call last):
>   File "/home/ubuntu/mnt/web2py/gluon/main.py", line 445, in wsgibase
> serve_controller(request, response, session)
>   File "/home/ubuntu/mnt/web2py/gluon/main.py", line 207, in 
> serve_controller
> raise HTTP(response.status, page, **response.headers)
> gluon.http.HTTP: 200 OK
>  
> During handling of the above exception, another exception occurred:
>  
> Traceback (most recent call last):
>   File "/home/ubuntu/mnt/web2py/gluon/main.py", line 472, in wsgibase
> BaseAdapter.close_all_instances('commit')
>   File "/home/ubuntu/mnt/web2py/gluon/packages/dal/pydal/connection.py", 
> line 121, in close_all_instances
> db._adapter.close(action)
>   File "/home/ubuntu/mnt/web2py/gluon/packages/dal/pydal/connection.py", 
> line 98, in close
> if len(pool) < self.pool_size:
> TypeError: '<' not supported between instances of 'int' and 'str'
>
>
> In my apache error log I see this:
>
> [Thu Nov 15 04:02:26.546712 2018] [wsgi:error] [pid 9117] [client 
> XXX.XXX.XXX.AA:56599] Timeout when reading response headers from daemon 
> process 'web2pydefault': /home/ubuntu/mnt/web2py/wsgihandler.py
> [Thu Nov 15 04:08:52.161152 2018] [wsgi:error] [pid 9111] [client 
> XXX.XXX.XXX.AB:40713] Timeout when reading response headers from daemon 
> process 'web2pydefault': /home/ubuntu/mnt/web2py/wsgihandler.py
> [Thu Nov 15 04:26:51.746340 2018] [wsgi:error] [pid 8081] [client 
> XXX.XXX.XXX.AC:2960] Timeout when reading response headers from daemon 
> process 'web2pydefault': /home/ubuntu/mnt/web2py/wsgihandler.py
> [Thu Nov 15 04:38:41.429260 2018] [wsgi:error] [pid 8081] [client 
> XXX.XXX.XXX.AD:48360] Timeout when reading response headers from daemon 
> process 'web2pydefault': /home/ubuntu/mnt/web2py/wsgihandler.py
> [Thu Nov 15 04:44:56.502509 2018] [wsgi:error] [pid 7466] [remote 
> XXX.XXX.XXX.AE:7339] mod_wsgi (pid=7466): Exception occurred processing 
> WSGI script '/home/ubuntu/mnt/web2py/wsgihandler.py'.
> [Thu Nov 15 04:44:56.502575 2018] [wsgi:error] [pid 7466] [remote 
> XXX.XXX.XXX.AE:7339] TypeError: sequence of byte string values expected, 
> value of type str found
> [Thu Nov 15 04:50:20.030220 2018] [wsgi:error] [pid 8081] [client 
> XXX.XXX.XXX.AF:33766] Timeout when reading response headers from daemon 
> process 'web2pydefault': /home/ubuntu/mnt/web2py/wsgihandler.py
> [Thu Nov 15 05:00:40.384970 2018] [ssl:warn] [pid 9665] AH01909: 
> XXX.XXX.XXX.AG:443:0 server certificate does NOT include an ID which 
> matches the server name
> [Thu Nov 15 05:00:40.407686 2018] [ssl:warn] [pid 9667] AH01909: 
> XXX.XXX.XXX.AG:443:0 server certificate does NOT include an ID which 
> matches the server name
> [Thu Nov 15 05:03:10.875058 2018] [wsgi:error] [pid 9668] [remote 
> XXX.XXX.XXX.AF:34126] 
> /home/ubuntu/mnt/web2py/gluon/contrib/pymysql/cursors.py:166: Warning: 
> (3090, "Changing sql mode 'NO_AUTO_CREATE_USER' is deprecated. It will be 
> removed in a future release.")
> [Thu Nov 15 05:03:10.875093 2018] [wsgi:error] [pid 9668] [remote 
> XXX.XXX.XXX.AF:34126]   result = self._query(query)
>
> Is it possibly related to this?:
>
> stackoverflow: TypeError: sequence of byte string values expected, value 
> of type str found 
> 
>
>
>
> On Saturday, 8 September 2018 12:22:49 UTC-7, Peter wrote:
>>
>> Try to remove all session files. I think that problem is in pickle which 
>> is different in python 2 and python 3 (data type is not same in python 2 
>> and python 3).
>>
>> Use fresh source code of web2py with your application. Don't start web2py 
>> with python 3 after use with python 2. 
>>
>

-- 
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.


[web2py] Re: Problem with wsgihandler.py Apache/Python3

2018-11-18 Thread Dave
I'm having the same troubles after upgrading to python3 using Apache 
with libapache2-mod-wsgi-py3 4.5.17-1 on Ubuntu.

I did delete all session files, and I am using fresh source code of web2py 
(R-2.17.2).

I'm running several applications in web2py, and when i restart Apache they 
work for a while. Then at some point later, and I haven't figured out what 
initiates the problem, I am getting:

Traceback (most recent call last):
  File "/home/ubuntu/mnt/web2py/gluon/main.py", line 445, in wsgibase
serve_controller(request, response, session)
  File "/home/ubuntu/mnt/web2py/gluon/main.py", line 207, in 
serve_controller
raise HTTP(response.status, page, **response.headers)
gluon.http.HTTP: 200 OK
 
During handling of the above exception, another exception occurred:
 
Traceback (most recent call last):
  File "/home/ubuntu/mnt/web2py/gluon/main.py", line 472, in wsgibase
BaseAdapter.close_all_instances('commit')
  File "/home/ubuntu/mnt/web2py/gluon/packages/dal/pydal/connection.py", 
line 121, in close_all_instances
db._adapter.close(action)
  File "/home/ubuntu/mnt/web2py/gluon/packages/dal/pydal/connection.py", 
line 98, in close
if len(pool) < self.pool_size:
TypeError: '<' not supported between instances of 'int' and 'str'


In my apache error log I see this:

[Thu Nov 15 04:02:26.546712 2018] [wsgi:error] [pid 9117] [client 
XXX.XXX.XXX.AA:56599] Timeout when reading response headers from daemon 
process 'web2pydefault': /home/ubuntu/mnt/web2py/wsgihandler.py
[Thu Nov 15 04:08:52.161152 2018] [wsgi:error] [pid 9111] [client 
XXX.XXX.XXX.AB:40713] Timeout when reading response headers from daemon 
process 'web2pydefault': /home/ubuntu/mnt/web2py/wsgihandler.py
[Thu Nov 15 04:26:51.746340 2018] [wsgi:error] [pid 8081] [client 
XXX.XXX.XXX.AC:2960] Timeout when reading response headers from daemon 
process 'web2pydefault': /home/ubuntu/mnt/web2py/wsgihandler.py
[Thu Nov 15 04:38:41.429260 2018] [wsgi:error] [pid 8081] [client 
XXX.XXX.XXX.AD:48360] Timeout when reading response headers from daemon 
process 'web2pydefault': /home/ubuntu/mnt/web2py/wsgihandler.py
[Thu Nov 15 04:44:56.502509 2018] [wsgi:error] [pid 7466] [remote 
XXX.XXX.XXX.AE:7339] mod_wsgi (pid=7466): Exception occurred processing 
WSGI script '/home/ubuntu/mnt/web2py/wsgihandler.py'.
[Thu Nov 15 04:44:56.502575 2018] [wsgi:error] [pid 7466] [remote 
XXX.XXX.XXX.AE:7339] TypeError: sequence of byte string values expected, 
value of type str found
[Thu Nov 15 04:50:20.030220 2018] [wsgi:error] [pid 8081] [client 
XXX.XXX.XXX.AF:33766] Timeout when reading response headers from daemon 
process 'web2pydefault': /home/ubuntu/mnt/web2py/wsgihandler.py
[Thu Nov 15 05:00:40.384970 2018] [ssl:warn] [pid 9665] AH01909: 
XXX.XXX.XXX.AG:443:0 server certificate does NOT include an ID which 
matches the server name
[Thu Nov 15 05:00:40.407686 2018] [ssl:warn] [pid 9667] AH01909: 
XXX.XXX.XXX.AG:443:0 server certificate does NOT include an ID which 
matches the server name
[Thu Nov 15 05:03:10.875058 2018] [wsgi:error] [pid 9668] [remote 
XXX.XXX.XXX.AF:34126] 
/home/ubuntu/mnt/web2py/gluon/contrib/pymysql/cursors.py:166: Warning: 
(3090, "Changing sql mode 'NO_AUTO_CREATE_USER' is deprecated. It will be 
removed in a future release.")
[Thu Nov 15 05:03:10.875093 2018] [wsgi:error] [pid 9668] [remote 
XXX.XXX.XXX.AF:34126]   result = self._query(query)

Is it possibly related to this?:

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




On Saturday, 8 September 2018 12:22:49 UTC-7, Peter wrote:
>
> Try to remove all session files. I think that problem is in pickle which 
> is different in python 2 and python 3 (data type is not same in python 2 
> and python 3).
>
> Use fresh source code of web2py with your application. Don't start web2py 
> with python 3 after use with python 2. 
>

-- 
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.


[web2py] Re: Problem with wsgihandler.py Apache/Python3

2018-09-08 Thread Peter
Try to remove all session files. I think that problem is in pickle which is 
different in python 2 and python 3 (data type is not same in python 2 and 
python 3).

-- 
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.


[web2py] Re: Problem with wsgihandler.py Apache/Python3

2018-09-02 Thread 黄祥
there are a lot of suggestion in this forum to not use apache to serve 
web2py, perhaps you can try another web server, e.g. nginx, gunicorn
wsgihandler.py had tested and running fine with gunicorn

best regards,
stifan

-- 
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.