Differences between version 6 and predecessor to the previous major change of PythonNotes.
Other diffs: Previous Revision, Previous Author, or view the Annotated Edit History
Newer page: | version 6 | Last edited on Wednesday, December 12, 2007 12:03:47 pm | by JohnMcPherson | Revert |
Older page: | version 5 | Last edited on Thursday, September 20, 2007 10:54:57 am | by JohnMcPherson | Revert |
@@ -23,7 +23,20 @@
The ''subprocess'' module is also buggy if you have multiple threads using subprocess to create child processes. Basically, it isn't thread-safe when checking if a child has finished, and you occasionally get "<tt>~[Errno 10] No child processes</tt>" exceptions. See [mailing list thread|http://www.mail-archive.com/python-bugs-list@python.org/msg12685.html].
!! 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.
+
+!!! Miscallaneous
+
+!! os.getlogin()
+The ''getlogin()'' function is supposed to return the username of the owner of the process. Unfortunately this works by looking in utmp(5),
+and most terminal emulators in linux don't bother creating a new record for each window. This means the OS returns "ENOENT", and python
+happily prints out <tt>OSError: ~[Errno 2] No such file or directory</tt>. On Linux/POSIX systems, you are probably better off doing:
+<verbatim>
+import os
+import pwd
+username = pwd.getpwuid(os.geteuid())[0]
+</verbatim>
+
----
CategoryProgramming, CategoryNotes