Why didn't you post your solution??? 
This is the top result in Google search for "SocketTimeout: Socket timed 
out before request." and still there is no resolution of the problem.

So, after spending two hours on this, let me save other novices from going 
down the same route:
This error happens when you forget to close if-else block with a "pass" 
statement

Example:
This will generate the error:
{{
if myVar:
response.write(uploadContent)
}}

This will work as expected:
{{
if myVar:
response.write(uploadContent)
pass
}}

A small suggestion for devs: update error message to mention possible 
missing "pass" statement.

Thank you and BR
Loreia



On Thursday, March 3, 2011 6:27:00 AM UTC+1, Lennon wrote:
>
> PROBLEM SOLVED 
>
> Stupid Mistake. 
>
> Please close/delete thread if possible or let me know how I can 
> accomplish that. 
>
> On Mar 3, 12:07 am, Lennon <lpru...@hotmail.com> wrote: 
> > Let me also add that I have: 
> > 
> > num_trav -= 1 
> > 
> > in the appropriate place to prevent an infinite loop that might be 
> > causing this.  But according to the debugger, the function isn't 
> > making it past: 
> > 
> > for k, v in request.vars.items() 
> > 
> > anyway. 
> > 
> > On Mar 2, 11:58 pm, Lennon <lpru...@hotmail.com> wrote: 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > > The following code got me a socket timeout error: 
> > 
> > > for trip in session.trip_cart: 
> > >     t_id = trip['trip_instance'] 
> > >     num_trav = trip['quantity'] - 1 
> > >     while num_trav > 0: 
> > >         new_trav = dict() 
> > >         for k, v in request.vars.items(): 
> > >             #get the field's trip_instance number 
> > >             #rest of code omitted. 
> > 
> > > Traceback (most recent call last): 
> > >   File "C:\Users\Lennon\workspace\web2py_source\gluon\rocket.py", line 
> > > 1064, in run 
> > >     self.run_app(conn) 
> > >   File "C:\Users\Lennon\workspace\web2py_source\gluon\rocket.py", line 
> > > 1531, in run_app 
> > >     self.environ = environ = self.build_environ(sock_file, conn) 
> > >   File "C:\Users\Lennon\workspace\web2py_source\gluon\rocket.py", line 
> > > 1363, in build_environ 
> > >     request = self.read_request_line(sock_file) 
> > >   File "C:\Users\Lennon\workspace\web2py_source\gluon\rocket.py", line 
> > > 1138, in read_request_line 
> > >     raise SocketTimeout("Socket timed out before request.") 
> > > SocketTimeout: Socket timed out before request. 
> > 
> > > Through use of the debugger I've determined that the line that is 
> > > causing the error is: 
> > 
> > > for k, v in request.vars.items() 
> > 
> > > This is strange to me because I've used that same line in other places 
> > > but I've never had a problem with it. 
> > 
> > > One possibility is that this code is part of a larger function (so now 
> > > the function maybe takes too long?), but a the function ran fine 
> > > before the above code was added.  I see that the socket times out 
> > > after 10 seconds but this error seems to happen almost instantaneously 
> > > when I submit my form. 
> > 
> > > One last strange occurrence is that when I clicked the ticket for the 
> > > above error, Google Chrome opened the ticket and also popped up the 
> > > following message in an alert box: 
> > 
> > > "Exception during snapshot rendering: Traceback (most recent call 
> > > last): 
> > > File 
> > > "C:path_to_my_web2py/admin/viewsdefault/ticket.html", line 
> > > 170, in <module> 
> > > KeyError: 'request' 
> > 
> > > I've never had Google Chrome pop up an alert for any of my tickets 
> > > although this might be unrelated.

-- 



Reply via email to