[IronPython] URLLIB Issue

2008-04-04 Thread Davy Mitchell
Hello List,

Has this been covered before? Trailed Codeplex and mailing list :-)

import encodings
import twitter
api = twitter.Api()
statuses = api.GetPublicTimeline()
print [s.user.name for s in statuses]

Produces:

Traceback (most recent call last):
  File it.py, line 4, in Initialize
  File C:\Code\OSProjects\twitter.py, line 923, in GetPublicTimeline
  File C:\Code\OSProjects\twitter.py, line 1435, in _FetchUrl
  File C:\python25\lib\urllib2.py, line 381, in open
  File C:\python25\lib\urllib2.py, line 398, in _open
  File Snippets.debug, line unknown, in _call_chain
  File C:\python25\lib\urllib2.py, line 360, in _call_chain
  File C:\python25\lib\urllib2.py, line 1107, in http_open
  File C:\python25\lib\urllib2.py, line 1096, in do_open
TypeError: _fileobject() got an unexpected keyword argument 'close'

CPython works as expected.

Thanks,
Davy

-- 
Davy Mitchell
Blog - http://www.latedecember.co.uk/sites/personal/davy/
Twitter - http://twitter.com/daftspaniel
Skype - daftspaniel http://needgod.com
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] URLLIB Issue

2008-04-04 Thread Dino Viehland
I haven't seen this one before - the repro seems to be as simple as:

import socket
socket._fileobject(None, close='abc')

but it's not clear to me what providing close does.  Urllib2 seems to be 
passing True - does anyone know what it does?  My guess is it causes the socket 
to be passed in but it's not documented.  If that was what it does it'd be easy 
enough to fix.

From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Davy Mitchell
Sent: Friday, April 04, 2008 2:41 PM
To: Discussion of IronPython
Subject: [IronPython] URLLIB Issue

Hello List,

Has this been covered before? Trailed Codeplex and mailing list :-)

import encodings
import twitter
api = twitter.Api()
statuses = api.GetPublicTimeline()
print [s.user.namehttp://s.user.name for s in statuses]

Produces:

Traceback (most recent call last):
  File it.py, line 4, in Initialize
  File C:\Code\OSProjects\twitter.py, line 923, in GetPublicTimeline
  File C:\Code\OSProjects\twitter.py, line 1435, in _FetchUrl
  File C:\python25\lib\urllib2.py, line 381, in open
  File C:\python25\lib\urllib2.py, line 398, in _open
  File Snippets.debug, line unknown, in _call_chain
  File C:\python25\lib\urllib2.py, line 360, in _call_chain
  File C:\python25\lib\urllib2.py, line 1107, in http_open
  File C:\python25\lib\urllib2.py, line 1096, in do_open
TypeError: _fileobject() got an unexpected keyword argument 'close'

CPython works as expected.

Thanks,
Davy

--
Davy Mitchell
Blog - http://www.latedecember.co.uk/sites/personal/davy/
Twitter - http://twitter.com/daftspaniel
Skype - daftspaniel http://needgod.com
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] URLLIB Issue

2008-04-04 Thread Curt Hagenlocher
In CPython 2.5.2, the prototype of _fileobject.__init__ is this:
def __init__(self, sock, mode='rb', bufsize=-1, close=False):

The close flag controls whether or not the socket should be closed when the
file is closed.  As such, this may be directly related to CodePlex issue
10825 -- and indicates that the solution I suggested for that issue is again
totally wrong. :)
On Fri, Apr 4, 2008 at 3:10 PM, Dino Viehland [EMAIL PROTECTED]
wrote:

  I haven't seen this one before – the repro seems to be as simple as:



 import socket

 socket._fileobject(None, close='abc')



 but it's not clear to me what providing close does.  Urllib2 seems to be
 passing True – does anyone know what it does?  My guess is it causes the
 socket to be passed in but it's not documented.  If that was what it does
 it'd be easy enough to fix.



 *From:* [EMAIL PROTECTED] [mailto:
 [EMAIL PROTECTED] *On Behalf Of *Davy Mitchell
 *Sent:* Friday, April 04, 2008 2:41 PM
 *To:* Discussion of IronPython
 *Subject:* [IronPython] URLLIB Issue



 Hello List,

 Has this been covered before? Trailed Codeplex and mailing list :-)

 import encodings
 import twitter
 api = twitter.Api()
 statuses = api.GetPublicTimeline()
 print [s.user.name for s in statuses]

 Produces:

 Traceback (most recent call last):
   File it.py, line 4, in Initialize
   File C:\Code\OSProjects\twitter.py, line 923, in GetPublicTimeline
   File C:\Code\OSProjects\twitter.py, line 1435, in _FetchUrl
   File C:\python25\lib\urllib2.py, line 381, in open
   File C:\python25\lib\urllib2.py, line 398, in _open
   File Snippets.debug, line unknown, in _call_chain
   File C:\python25\lib\urllib2.py, line 360, in _call_chain
   File C:\python25\lib\urllib2.py, line 1107, in http_open
   File C:\python25\lib\urllib2.py, line 1096, in do_open
 TypeError: _fileobject() got an unexpected keyword argument 'close'

 CPython works as expected.

 Thanks,
 Davy

 --
 Davy Mitchell
 Blog - http://www.latedecember.co.uk/sites/personal/davy/
 Twitter - http://twitter.com/daftspaniel
 Skype - daftspaniel http://needgod.com

 ___
 Users mailing list
 Users@lists.ironpython.com
 http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com