This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: urllib.urlopen crashes when launched from a thread
Type: Stage: resolved
Components: None Versions: Python 2.6
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: olivier-berten, orsenthil
Priority: normal Keywords:

Created on 2010-06-23 16:14 by olivier-berten, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (2)
msg108458 - (view) Author: Olivier Berten (olivier-berten) Date: 2010-06-23 16:14
I'm writing SwatchBooker <https://launchpad.net/swatchbooker>, an app that's (among other things) reading some data from the web. When urllib.urlopen is called first from within a secondary thread, the app crashes (or freezes). If it's been called first from the main thread, there's no problem.

You can reproduce that by downloading http://launchpad.net/swatchbooker/trunk/0.7/+download/SwatchBooker-0.7.noinstall.zip

1. Launch swatchbooker.pyw
2. Open from web
3. Select ICI Dulux, Pantone or RAL
4. Cancel
5. Close the program
6. Relaunch swatchbooker.pyw
7. Open from web
8. Choose any swatch from ICI Dulux, Pantone or RAL (Don't click ColorCharts.org or Digital Colour Atlas!)
9. OK
10. Crash

For ColorCharts.org and Digital Colour Atlas, the list itself is loaded through urllib.urlopen from the main thread so it makes the rest go smoothly...
msg108465 - (view) Author: Senthil Kumaran (orsenthil) * (Python committer) Date: 2010-06-23 17:47
There isn't a problem with urllib with respect to threading as such. 
There are programs and examples which use this module in multi-threading environment. 

I could not run your app, I am not on Mac, but some of the changes you could try is:
- Not to pollute module namespace with from somemodule import *  ( And in the process importing urllib).
- Use the 'import urllib' in each of the module that you using.

If you have specific traceback, post it here. ( An smaller snippet/example to reproduce will help). Feel free to reopen the issue if you see that it indeed a bug.
History
Date User Action Args
2022-04-11 14:57:02adminsetgithub: 53308
2010-06-23 17:47:08orsenthilsetstatus: open -> closed

nosy: + orsenthil
messages: + msg108465

resolution: not a bug
stage: resolved
2010-06-23 16:14:58olivier-bertencreate