Differences between version 4 and predecessor to the previous major change of PythonNotes.
Other diffs: Previous Revision, Previous Author, or view the Annotated Edit History
Newer page: | version 4 | Last edited on Thursday, June 21, 2007 8:54:12 pm | by JohnMcPherson | Revert |
Older page: | version 3 | Last edited on Friday, March 4, 2005 11:36:39 am | by JohnMcPherson | Revert |
@@ -13,7 +13,15 @@
<verbatim>
ptime = time.strptime("2004-10-06 10:00:00", "%Y-%m-%d %H:%M:%S")[:8] + (-1,)
</verbatim>
This is what [Python] 2.3 does, implicitly.
+
+!!! threads
+
+!! subprocess module
+If you use the ''subprocess'' module to spawn a child in one of your threads and you are using locks, there is a possibility of a deadlock. See the discussion in the [python newsgroup|http://groups.google.com/group/comp.lang.python/browse_thread/thread/5fae8a453c95ae89/42f5c9f9215dbb1e#42f5c9f9215dbb1e]. Basically, python internally uses locks during imports, and you can fix it in this instance by moving the ''"from errno import ENOENT, ENOTDIR"'' line from the ''_execvpe'' function in the subprocess.py module up to the top, so that it doesn't happen after the fork(). This affects python 2.4 at least, not sure if it's fixed in 2.5.
+
+!! python-gtk
+If you want to do ''thread.start_new_thread()'' from within an app using pygtk, you need to call ''gtk.gdk.threads_init()'' first, otherwise the gtk event loop will screw you up.
----
CategoryProgramming, CategoryNotes