[opensuse-buildservice] osc r7259 (timeout) depends on Python 2.6
Hi, poeml@batavia510 ~ % osc rdelete home:poeml:branches:Subversion Traceback (most recent call last): File "/suse/poeml/bin/osc", line 12, in <module> r = babysitter.run(osccli) File "/suse/poeml/osc-trunk/osc/babysitter.py", line 38, in run return prg.main() File "/suse/poeml/osc-trunk/osc/cmdln.py", line 255, in main return self.cmd(args) File "/suse/poeml/osc-trunk/osc/cmdln.py", line 278, in cmd retval = self.onecmd(argv) File "/suse/poeml/osc-trunk/osc/cmdln.py", line 394, in onecmd return self._dispatch_cmd(handler, argv) File "/suse/poeml/osc-trunk/osc/cmdln.py", line 1084, in _dispatch_cmd return handler(argv[0], opts, *args) File "/suse/poeml/osc-trunk/osc/commandline.py", line 1001, in do_rdelete elif len(meta_get_packagelist(conf.config['apiurl'], prj)) >= 1 and not opts.force: File "/suse/poeml/osc-trunk/osc/core.py", line 1625, in meta_get_packagelist f = http_GET(u) File "/suse/poeml/osc-trunk/osc/core.py", line 1552, in http_GET def http_GET(*args, **kwargs): return http_request('GET', *args, **kwargs) File "/suse/poeml/osc-trunk/osc/core.py", line 1542, in http_request fd = urllib2.urlopen(req, data=data, timeout=timeout) TypeError: urlopen() got an unexpected keyword argument 'timeout' [1] 9270 exit 1 osc rdelete home:poeml:branches:Subversion the timeout argument to urllib2.urlopen was introduced with Python 2.6, as it seems. One way to work around would be to set socket.setdefaulttimeout(timeout); possibly only for certain commands; or globally if it doesn't have negative effects. What do you think? Peter -- "WARNING: This bug is visible to non-employees. Please be respectful!" SUSE LINUX Products GmbH Research & Development
On 2009-05-06 12:32:26 +0200, Peter Poeml wrote:
TypeError: urlopen() got an unexpected keyword argument 'timeout' [1] 9270 exit 1 osc rdelete home:poeml:branches:Subversion
the timeout argument to urllib2.urlopen was introduced with Python 2.6, as it seems.
Hmm yes it seems so (I only tested it with python26:) ).
One way to work around would be to set socket.setdefaulttimeout(timeout); possibly only for certain commands; or globally if it doesn't have negative effects.
What do you think? I think this should be ok - in the end urllib2 passes the timeout parameter to httplib which passes it to the socket module. Using a global timeout for all osc requests won't harm IMHO (if some command doesn't need it can use e.g. http_GET(url, timeout=None) to disable the default timeout). Does the attached patch work with python24?
Marcus
On Thu, May 07, 2009 at 07:17:11 +0200, Marcus Hüwe wrote:
On 2009-05-06 12:32:26 +0200, Peter Poeml wrote:
TypeError: urlopen() got an unexpected keyword argument 'timeout' [1] 9270 exit 1 osc rdelete home:poeml:branches:Subversion
the timeout argument to urllib2.urlopen was introduced with Python 2.6, as it seems.
Hmm yes it seems so (I only tested it with python26:) ).
One way to work around would be to set socket.setdefaulttimeout(timeout); possibly only for certain commands; or globally if it doesn't have negative effects.
What do you think? I think this should be ok - in the end urllib2 passes the timeout parameter to httplib which passes it to the socket module. Using a global timeout for all osc requests won't harm IMHO (if some command doesn't need it can use e.g. http_GET(url, timeout=None) to disable the default timeout).
I don't think that it harms either. I was only wondering if the setting via socket.setdefaulttimeout would be more global than setting it via the http_* methods, and would have a broader effect. But it has the same result I guess.
Does the attached patch work with python24?
It works with python25 (and I see no reason why it shouldn't work with 2.4 as well). Thanks, Peter -- "WARNING: This bug is visible to non-employees. Please be respectful!" SUSE LINUX Products GmbH Research & Development
On 2009-05-08 10:44:00 +0200, Peter Poeml wrote:
On Thu, May 07, 2009 at 07:17:11 +0200, Marcus Hüwe wrote:
I think this should be ok - in the end urllib2 passes the timeout parameter to httplib which passes it to the socket module. Using a global timeout for all osc requests won't harm IMHO (if some command doesn't need it can use e.g. http_GET(url, timeout=None) to disable the default timeout).
I don't think that it harms either. I was only wondering if the setting via socket.setdefaulttimeout would be more global than setting it via the http_* methods, and would have a broader effect. But it has the same result I guess.
Using setdefaulttimeout is probably more "global" than the way how it is done in python26's urllib2/httplib but we directly restore the default after we made the request (so in most cases it shouldn't have any side effects).
Does the attached patch work with python24?
It works with python25 (and I see no reason why it shouldn't work with 2.4 as well).
Ok - committed (r7290). Marcus -- To unsubscribe, e-mail: opensuse-buildservice+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-buildservice+help@opensuse.org
participants (2)
-
Marcus Hüwe
-
Peter Poeml