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


Groups > comp.lang.python > #21824 > unrolled thread

Re: urllib.urlretrieve never returns???

Started byLaszlo Nagy <gandalf@shopzeus.com>
First post2012-03-17 18:31 +0100
Last post2012-03-17 18:31 +0100
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

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

#21824 — Re: urllib.urlretrieve never returns???

FromLaszlo Nagy <gandalf@shopzeus.com>
Date2012-03-17 18:31 +0100
SubjectRe: urllib.urlretrieve never returns???
Message-ID<mailman.761.1332005526.3037.python-list@python.org>
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.

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web