urllib2 timeout problem inside Zope thread

View: New views
2 Messages — Rating Filter:   Alert me  

urllib2 timeout problem inside Zope thread

by Thierry FLORAC :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


  Hi,

I'm currently using urllib2 to get an external URL from an internal
"cron like" Zope thread.
The loaded page has to manage administrative tasks before I can start
other tasks into Zope internal database ; it returns partial chunks of
data, but globally takes more than 20 minutes to run.

Problem : when loading the page via a simple Python console, I set
socket.setdefaulttimeout() and everything is OK ; but when launching the
same command from inside Zope thread, I get a socket.timeout error.

So my question : as I'd really prefer to keep this method call inside an
internal Zope thread, how can I prevent this timeout ?

Thanks for any help,

  Thierry Florac
--
  Chef de projet intranet/internet
  Office National des Forêts - Département Informatique
  2, Avenue de Saint-Mandé
  75570 PARIS Cedex 12
  Mél : thierry.florac@...
  Tél. : +33 01.40.19.59.64
  Fax. : +33 01.40.19.59.85

_______________________________________________
Zope maillist  -  Zope@...
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists -
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )

Re: urllib2 timeout problem inside Zope thread

by Dieter Maurer :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thierry Florac wrote at 2008-7-24 10:04 +0200:
> ...
>I'm currently using urllib2 to get an external URL from an internal
>"cron like" Zope thread.
> ...
>So my question : as I'd really prefer to keep this method call inside an
>internal Zope thread, how can I prevent this timeout ?

"urllib2" is quite modular:

  When you create an opener, you can pass in various handlers,
  among others an "HTTPHandler".

  You can tweak the HTTPHandler you pass in in a way to set
  whatever timeout your socket should use.



--
Dieter
_______________________________________________
Zope maillist  -  Zope@...
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists -
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )