Issue1542
Created on 2010-01-14.07:23:43 by julyzergcn, last changed 2010-01-18.21:13:15 by amak.
| Messages | |||
|---|---|---|---|
| msg5437 (view) | Author: july (julyzergcn) | Date: 2010-01-14.07:23:41 | |
urllib.urlretrieve cannot close connection automatically.
also, urllib.urlopen cannot close.
e.g.
if I want to download a file from a ftp server, write one line like this,
import urllib
urllib.urlretrieve('ftp://user:pass@hostname/fdir', 'localname')
after the file is download, the connection cannot close automatically, but Python2.5 can.
also, the following code can not close the connection as well.
import urllib
f = urllib(''ftp://user:pass@hostname/fdir')
print f.read()
f.close()
would it be possible to make Jython close the connection like Python?
thanks
|
|||
| msg5442 (view) | Author: Alan Kennedy (amak) | Date: 2010-01-18.21:13:12 | |
I'm sorry, but I don't understand this bug report.
> urllib.urlretrieve cannot close connection automatically.
> also, urllib.urlopen cannot close.
> e.g.
> if I want to download a file from a ftp server, write one line like this,
> import urllib
> urllib.urlretrieve('ftp://user:pass@hostname/fdir', 'localname')
> after the file is download, the connection cannot close automatically, but Python2.5 can.
When I run the above code on Windows, both cpython and jython keep the socket connection open.
> also, the following code can not close the connection as well.
> import urllib
> f = urllib(''ftp://user:pass@hostname/fdir')
> print f.read()
> f.close()
This could has syntax errors, and tries to call to call the urllib module directly, rather than a function in the module, which breaks with "Module not callable".
Please can you post a running example, which illustrates the behaviour you expect to see? Use a public FTP URL that doesn't need login credentials.
> would it be possible to make Jython close the connection like Python?
> thanks
Are you relying on cpython's garbage collection, which is different to jython's, to close the socket for you, perhaps?
http://mail.python.org/pipermail/python-dev/2008-May/079218.html
|
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2010-01-18 21:13:15 | amak | set | nosy:
+ amak messages: + msg5442 |
| 2010-01-14 07:23:43 | julyzergcn | create | |