Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #21824

Re: urllib.urlretrieve never returns???

Date 2012-03-17 18:31 +0100
From Laszlo Nagy <gandalf@shopzeus.com>
Subject Re: urllib.urlretrieve never returns???
References <4F649BFC.1080601@shopzeus.com> <CAPTjJmq+e1mpvbqCjJ3FsUkPtGcwTpSNgb9jDsO4trX9XDH6ew@mail.gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.761.1332005526.3037.python-list@python.org> (permalink)

Show all headers | View raw


2012.03.17. 17:34 keltezéssel, Chris Angelico wrote
> 2012/3/18 Laszlo Nagy<gandalf@shopzeus.com>:
>> In the later case, "log.txt" only contains "#1" and nothing else. If I look
>> at pythonw.exe from task manager, then its shows +1 thread every time I
>> click the button, and "#1" is appended to the file.
>          try:
>              fpath = urllib.urlretrieve(imgurl)[0]
>          except:
>              self.Log(traceback.format_exc())
>              return
>
>
> Just a stab in the dark, but I'm wondering if something's throwing an
> exception when it's running without a GUI? Your except clause
> references 'traceback' which I don't see anywhere else - or is that
> part of the code you can't share? Anyway, my guess is that something
> perhaps tries to write to the console and can't, and it gets stuck
> inside format_exc(). Is that testable?
You are right, I should have added "import traceback". However, I tried 
this:

         try:
             fpath = urllib.urlretrieve(imgurl)[0]
         except:
             self.Log("Exception")
             return


and still nothing was logged. Another proof is that the number of 
threads is increased every time I press the button. So I'm 100% sure 
that urlretrieve does not return from the call.

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: urllib.urlretrieve never returns??? Laszlo Nagy <gandalf@shopzeus.com> - 2012-03-17 18:31 +0100

csiph-web