Re: Obtaining user information

2011-12-09 Thread Hans Mulder
On 10/12/11 02:44:48, Tim Chase wrote: Currently I can get the currently-logged-in-userid via getpass.getuser() which would yield something like "tchase". Is there a cross-platform way to get the full username (such as from the GECOS field of /etc/passed or via something like NetUserGetInfo on W

Re: Obtaining user information

2011-12-09 Thread Cameron Simpson
On 09Dec2011 19:44, Tim Chase wrote: | Currently I can get the currently-logged-in-userid via | getpass.getuser() which would yield something like "tchase". _If_ you're on a terminal. _And_ that's exactly what you want. Personally I need to the name of geteuid() or getuid() more often. | Is ther

Re: How to move scrollbar by code?

2011-12-09 Thread Chris Angelico
On Sat, Dec 10, 2011 at 4:05 PM, Muddy Coder wrote: > I am trying to make a listbox that will contain a looong data list, > sorted, so I will be able to pre-select a data line by coding. I have > done it. Which GUI toolkit are you using? What you want is not the Python language docs, but the docs

How to move scrollbar by code?

2011-12-09 Thread Muddy Coder
Hi Folks, I am trying to make a listbox that will contain a looong data list, sorted, so I will be able to pre-select a data line by coding. I have done it. Say my listbox contains 1000 data lines, and my program has figured out the data line 321 is needed, so just put the cursor on data line 321.

Re: Multiprocessing bug, is information ever omitted from a traceback?

2011-12-09 Thread Terry Reedy
On 12/9/2011 6:14 PM, John Ladasky wrote: http://groups.google.com/group/comp.lang.python/browse_frm/thread/751b7050c756c995# I'm programming in Python 2.6 on Ubuntu Linux 10.10, if it matters. It might, as many bugs have been fixed since. Can you try the same code with the most recent 2.x re

Re: Buffering of sys.stdout and sys.stderr in python3 (and documentation)

2011-12-09 Thread Terry Reedy
On 12/9/2011 2:32 PM, Geoff Bache wrote: Hi all, Short version: I'm a bit confused in general as to the changes between python2 and python3 regarding how standard output and standard error do buffering. A few things seem to have changed and I've failed to find any documentation of how and why.

Re: How to build 64-bit Python on Solaris with GCC?

2011-12-09 Thread Skip Montanaro
> ./configure CFLAGS=-m64 LDFLAGS=-m64 should work with a reasonably > recent revision. Thanks, that did, indeed work with CPython trunk. I eventually switched from gcc to Sun's compiler though because I was getting link warnings. Skip -- http://mail.python.org/mailman/listinfo/python-list

Obtaining user information

2011-12-09 Thread Tim Chase
Currently I can get the currently-logged-in-userid via getpass.getuser() which would yield something like "tchase". Is there a cross-platform way to get the full username (such as from the GECOS field of /etc/passed or via something like NetUserGetInfo on Win32 so I'd get "Tim Chase" instead?

Re: tracking variable value changes

2011-12-09 Thread Steven D'Aprano
On Thu, 08 Dec 2011 12:17:11 -0800, Catherine Moroney wrote: > Hello, > > Is there a way to create a C-style pointer in (pure) Python so the > following code will reflect the changes to the variable "a" in the > dictionary "x"? Strictly speaking, no, but there may be a way to get something close

Re: I love the decorator in Python!!!

2011-12-09 Thread 88888 Dihedral
On Saturday, December 10, 2011 2:28:49 AM UTC+8, 8 Dihedral wrote: > On Thursday, December 8, 2011 7:43:12 PM UTC+8, Chris Angelico wrote: > > On Thu, Dec 8, 2011 at 10:22 PM, K.-Michael Aye wrote: > > > I am still perplexed about decorators though, am happily using Python for > > > many years

Re: Python 2 or 3

2011-12-09 Thread Steven D'Aprano
On Sat, 10 Dec 2011 00:16:30 +0100, Enrico 'Henryx' Bianchi wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > Tobiah wrote: > >> Use the newer version and don't look back. > > Interesting reply, but if I have a platform wich doesn't support Python > 3 (e.g. RHEL 5.x)? ]:) RHEL suppo

Re: Python 2 or 3

2011-12-09 Thread Enrico 'Henryx' Bianchi
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Tobiah wrote: > Use the newer version and don't look back. Interesting reply, but if I have a platform wich doesn't support Python 3 (e.g. RHEL 5.x)? ]:) Enrico P.S. note that: I *don't* want to recompile Python in production environment -BEGIN

Multiprocessing bug, is information ever omitted from a traceback?

2011-12-09 Thread John Ladasky
Hi folks, A tangent off of this thread: http://groups.google.com/group/comp.lang.python/browse_frm/thread/751b7050c756c995# I'm programming in Python 2.6 on Ubuntu Linux 10.10, if it matters. I'm trying to track down a multiprocessing bug. Here's my traceback. All lines of code referenced in th

Re: Contacts/Addressbook application - any good Python ones out there?

2011-12-09 Thread tinnews
tinn...@isbd.co.uk wrote: > Alec Taylor wrote: > > Wammu? > > > I hadn't really considered gammu/wammu as I saw it as a mobile phone > synchrinsation tool, but I've looked a bit harder and it might very > well be what I need - thank you! > Well one problem with wammu is that you can't do anythin

Re: Dynamic variable creation from string

2011-12-09 Thread Ethan Furman
Massi wrote: Thank you all for your replies, first of all my Sum function was an example simplifying what I have to do in my real funciton. In general the D dictionary is complex, with a lot of keys, so I was searching for a quick method to access all the variables in it without doing the explici

Buffering of sys.stdout and sys.stderr in python3 (and documentation)

2011-12-09 Thread Geoff Bache
Hi all, Short version: I'm a bit confused in general as to the changes between python2 and python3 regarding how standard output and standard error do buffering. A few things seem to have changed and I've failed to find any documentation of how and why. Also, the meaning of "python -u" seems to h

Re: I love the decorator in Python!!!

2011-12-09 Thread 88888 Dihedral
On Thursday, December 8, 2011 7:43:12 PM UTC+8, Chris Angelico wrote: > On Thu, Dec 8, 2011 at 10:22 PM, K.-Michael Aye wrote: > > I am still perplexed about decorators though, am happily using Python for > > many years without them, but maybe i am missing something? > > For example in the above c

Re: Misleading error message of the day

2011-12-09 Thread Ethan Furman
Jean-Michel Pichavant wrote: Ethan Furman wrote: Jean-Michel Pichavant wrote: You have to opportunity to not use unpacking anymore :o) There is a recent thread were the dark side of unpacking was exposed. Unpacking is a cool feautre for very small applications but should be avoided whenever p

Re: Execute python within Oracle

2011-12-09 Thread Ian Kelly
2011/12/9 André Lopes : > Hi all, > > > >    I wrote a simple Java program to be called within an Oracle database. The > goal is to execute a Python program within the DB itself, by the means of a > Java program. The problem is that when I execute the procedure inside the > DB, nothing happens… > >

Re: order independent hash?

2011-12-09 Thread Chris Angelico
On Sat, Dec 10, 2011 at 3:51 AM, Hrvoje Niksic wrote: > The case of dicts which require frequent access, such as those used to > implement namespaces, is different, and more interesting.  Those dicts > are typically quite small, and for them the difference between O(log n) > and O(1) is negligible

Execute python within Oracle

2011-12-09 Thread André Lopes
Hi all, I wrote a simple Java program to be called within an Oracle database. The goal is to execute a Python program within the DB itself, by the means of a Java program. The problem is that when I execute the procedure inside the DB, nothing happens… If I create the same Java class ou

Re: order independent hash?

2011-12-09 Thread Hrvoje Niksic
Steven D'Aprano writes: > Except for people who needed dicts with tens of millions of items. Huge tree-based dicts would be somewhat slower than today's hash-based dicts, but they would be far from unusable. Trees are often used to organize large datasets for quick access. The case of dicts wh

Re: Contacts/Addressbook application - any good Python ones out there?

2011-12-09 Thread tinnews
Alec Taylor wrote: > Wammu? > I hadn't really considered gammu/wammu as I saw it as a mobile phone synchrinsation tool, but I've looked a bit harder and it might very well be what I need - thank you! > On Sat, Dec 10, 2011 at 1:41 AM, wrote: > > I'm after an application for managing Contacts (

Re: How to build 64-bit Python on Solaris with GCC?

2011-12-09 Thread Stefan Krah
Skip Montanaro wrote: > Thanks. I have several different versions in my local sandbox. None > are 64-bit ELFs. Just to make sure I hadn't missed some new development > in this area, I cloned the hg repository and build the trunk version > from scratch. I get a 32-bit executable on Solaris: >

Re: [OT] Book authoring

2011-12-09 Thread Nick Dokos
Nick Dokos wrote: > There is also orgmode, which has been used for a few books > (http://orgmode.org ). I know it does HTML and PDF (the latter through > latex), but I'm not sure about ePub: ISTR somebody actually did ePub for > his book but I don't remember details. Avdi Grimm produced his boo

Re: [OT] Book authoring

2011-12-09 Thread Andrea Crotti
On 12/09/2011 03:25 AM, Miki Tebeka wrote: Greetings, Any recommendations for a book authoring system that supports the following: 1. Code examples (with syntax highlighting and line numbers) 2. Output HTML, PDF, ePub ... 3. Automatic TOC and index 4. Search (in HTML) - this is a "nice to have"

Re: How to build 64-bit Python on Solaris with GCC?

2011-12-09 Thread Skip Montanaro
Karim gmail.com> writes: > ./configure > make > make install Thanks. I have several different versions in my local sandbox. None are 64-bit ELFs. Just to make sure I hadn't missed some new development in this area, I cloned the hg repository and build the trunk version from scratch. I get a

Re: [OT] Book authoring

2011-12-09 Thread Nick Dokos
Grant Edwards wrote: > On 2011-12-09, Miki Tebeka wrote: > > Greetings, > > > > Any recommendations for a book authoring system that supports the following: > > 1. Code examples (with syntax highlighting and line numbers) > > 2. Output HTML, PDF, ePub ... > > 3. Automatic TOC and index > > 4. Se

Re: [OT] Book authoring

2011-12-09 Thread Grant Edwards
On 2011-12-09, Miki Tebeka wrote: > Greetings, > > Any recommendations for a book authoring system that supports the following: > 1. Code examples (with syntax highlighting and line numbers) > 2. Output HTML, PDF, ePub ... > 3. Automatic TOC and index > 4. Search (in HTML) - this is a "nice to hav

Re: Contacts/Addressbook application - any good Python ones out there?

2011-12-09 Thread Alec Taylor
Wammu? On Sat, Dec 10, 2011 at 1:41 AM, wrote: > I'm after an application for managing Contacts (i.e. an Address Book) > and as I suspect I will want to 'tune' it a bit Python would be my > preferred language. > > So far I have found :- > >    pycocuma - reasonable but rather old and a bit clunk

Contacts/Addressbook application - any good Python ones out there?

2011-12-09 Thread tinnews
I'm after an application for managing Contacts (i.e. an Address Book) and as I suspect I will want to 'tune' it a bit Python would be my preferred language. So far I have found :- pycocuma - reasonable but rather old and a bit clunky (uses TCL/Tk) pyaddressbook - newer but very minimal D

Re: Misleading error message of the day

2011-12-09 Thread Roy Smith
In article , Jean-Michel Pichavant wrote: > Ethan Furman wrote: > > Jean-Michel Pichavant wrote: > >> You have to opportunity to not use unpacking anymore :o) There is a > >> recent thread were the dark side of unpacking was exposed. Unpacking > >> is a cool feautre for very small applications

Re: tracking variable value changes

2011-12-09 Thread Andrea Crotti
On 12/08/2011 08:17 PM, Catherine Moroney wrote: Hello, Is there a way to create a C-style pointer in (pure) Python so the following code will reflect the changes to the variable "a" in the dictionary "x"? For example: >>> a = 1.0 >>> b = 2.0 >>> x = {"a":a, "b":b} >>> x {'a': 1.0, 'b': 2.0}

Re: I love the decorator in Python!!!

2011-12-09 Thread Francesco Bochicchio
On 8 Dic, 12:22, K.-Michael Aye wrote: > On 2011-12-08 08:59:26 +, Thomas Rachel said: > > > > > Am 08.12.2011 08:18 schrieb 8 Dihedral: > >> I use the @ decorator to behave exactly like a c macro that > >> does have fewer side effects. > > >> I am wondering is there other interesting meth

Re: Dynamic variable creation from string

2011-12-09 Thread Chris Angelico
On Fri, Dec 9, 2011 at 10:59 PM, Steven D'Aprano wrote: > (4) If you think you can make exec safe with a prohibited list of > dangerous strings, you probably can't. If you think that it's even _possible_ to make exec safe with a blacklist, I have a nice padded cell for you over here. Security is

Re: Dynamic variable creation from string

2011-12-09 Thread Steven D'Aprano
On Fri, 09 Dec 2011 11:59:16 +, Steven D'Aprano wrote: > Just the second-most common source of viruses, malware and security > vulnerabilities (behind buffer overflows): code injection attacks. Oops, I forgot to go back and revise this sentence. Code injection attacks are now the most common

Re: Dynamic variable creation from string

2011-12-09 Thread Steven D'Aprano
On Fri, 09 Dec 2011 01:55:28 -0800, Massi wrote: > for k in D : exec "%s = D[k]" %k > > That seems to do the trick, but someone speaks about "dirty code", can > anyone point me out which problems this can generate? Again, thank you > for your help! Just the second-most common source of viruses,

Re: order independent hash?

2011-12-09 Thread Steven D'Aprano
On Thu, 08 Dec 2011 10:30:01 +0100, Hrvoje Niksic wrote: > In a language like Python, the difference between O(1) and O(log n) is > not the primary reason why programmers use dict; they use it because > it's built-in, efficient compared to alternatives, and convenient to > use. If Python dict had

Re: Dynamic variable creation from string

2011-12-09 Thread Peter Otten
Massi wrote: > for k in D : exec "%s = D[k]" %k > > That seems to do the trick, but someone speaks about "dirty code", can > anyone point me out which problems this can generate? exec can run arbitrary code, so everybody reading the above has to go back to the definition of D to verify that it

Re: Dynamic variable creation from string

2011-12-09 Thread Massi
Thank you all for your replies, first of all my Sum function was an example simplifying what I have to do in my real funciton. In general the D dictionary is complex, with a lot of keys, so I was searching for a quick method to access all the variables in it without doing the explicit creation: a,

Re: I love the decorator in Python!!!

2011-12-09 Thread Thomas Rachel
Am 08.12.2011 12:43 schrieb Chris Angelico: On Thu, Dec 8, 2011 at 10:22 PM, K.-Michael Aye wrote: I am still perplexed about decorators though, am happily using Python for many years without them, but maybe i am missing something? For example in the above case, if I want the names attached to

Re: I love the decorator in Python!!!

2011-12-09 Thread Robert Kern
On 12/9/11 5:02 AM, alex23 wrote: On Dec 9, 2:38 am, Chris Angelico wrote: One piece of sophistication that I would rather like to see, but don't know how to do. Instead of *args,**kwargs, is it possible to somehow copy in the function's actual signature? I was testing this out in IDLE, and the

Re: Misleading error message of the day

2011-12-09 Thread Jean-Michel Pichavant
Ethan Furman wrote: Jean-Michel Pichavant wrote: You have to opportunity to not use unpacking anymore :o) There is a recent thread were the dark side of unpacking was exposed. Unpacking is a cool feautre for very small applications but should be avoided whenever possible otherwise. Which thr

Re: subprocess.Popen under windows 7

2011-12-09 Thread Frank van den Boom
Thank you very much. Now I have written a little c++ programm which produces some ouput. And now it works fine. There is something wrong with 7zip.exe and the arglist with *. Tonight I will go on and hunt the error. It should be Python 2.7 #!/usr/bin/env python PATH_TO_EXE = "C:/Users/yoic

Re: subprocess.Popen under windows 7

2011-12-09 Thread Tim Golden
On 09/12/2011 08:32, Ulrich Eckhardt wrote: Am 08.12.2011 23:41, schrieb Frank van den Boom: arglist = [PATH_TO_7ZIP,"a", "-sfx", archive_name, "*", "-r", "-p",PASSWORD] The "*" is resolved by the shell, this is not a wildcard that gets passed to the program. At least not normally, your case m

Re: subprocess.Popen under windows 7

2011-12-09 Thread Ulrich Eckhardt
Am 08.12.2011 23:41, schrieb Frank van den Boom: arglist = [PATH_TO_7ZIP,"a", "-sfx", archive_name, "*", "-r", "-p",PASSWORD] The "*" is resolved by the shell, this is not a wildcard that gets passed to the program. At least not normally, your case might be different. if output: print o

Re: Multiprocessing bug, is my editor (SciTE) impeding my progress?

2011-12-09 Thread John Ladasky
Thanks once again to everyone for their recommendations, here's a follow-up. In summary, I'm still baffled. I tried ipython, as Marco Nawijn suggested. If there is some special setting which returns control to the interpreter when a subprocess crashes, I haven't found it yet. Yes, I'm RTFM. As

Re: subprocess.Popen under windows 7

2011-12-09 Thread Frank van den Boom
I didn't have Windows 7 right now, but that shouldn't happen with the code you've given; when trimming code for posting, you should check that the trimmed code still have the exact same problem. Here is the hole code: #!/usr/bin/env python # little script to backup recursive a folder with 7z