urllib.urlretrieve never returns???

Christian Heimes lists at cheimes.de
Sat Mar 17 14:18:25 EDT 2012


Am 17.03.2012 15:13, schrieb Laszlo Nagy:
> See attached example code. I have a program that calls exactly the same
> code, and here is the strange thing about it:
> 
>   * Program is started as "start.py", e.g. with an open console. In this
>     case, the program works!
>   * Program is started as "start.pyw", e.g. with no open console under
>     Windows 7 64bit - the program does not work!

The pythonw.exe may not have the rights to access network resources.
Have you set a default timeout for sockets?

import socket
socket.setdefaulttimeout(10) # 10 seconds

A pyw Python doesn't have stdout, stderr or stdin. Any attempt to write
to them (e.g. print statement, default exception logger) can cause an
exception.

Christian




More information about the Python-list mailing list