Re: Ways of accessing this mailing list?

2010-12-11 Thread Harishankar
On Sat, 11 Dec 2010 21:15:13 -0800, Monte Milanuk wrote: > Thunderbird + gmane works for me. I myself post using Pan Usenet client accessing this mailing list from gmane. The advantage of a proper newsreader software is that it quotes correctly (i.e. quote at top, reply below). Many Usenet and

Re: Ways of accessing this mailing list?

2010-12-11 Thread Monte Milanuk
On 12/11/10 3:32 PM, Martin Schoeoen wrote: On 2010-11-04, Mark Wooding wrote: John Bond writes: Hope this isn't too O/T - I was just wondering how people read/send to this mailing list, eg. normal email client, gmane, some other software or online service? Thunderbird + gmane works for me

Re: array and strings in Python 3

2010-12-11 Thread wander.lairson
> The `array` module's handling of strings changed as well. Reading the > Python 3 docs @ http://docs.python.org/dev/library/array.html , we > find (all emphases added): > class array.array(typecode[, initializer]) >    [...] >    If given a list or string, the initializer is passed to the new > ar

Re: array and strings in Python 3

2010-12-11 Thread Chris Rebert
On Sat, Dec 11, 2010 at 5:32 PM, wander.lairson wrote: > Hello, > > This is my first post on python mailing list. I've working in code > which must run on python 2 and python 3. I am using array.array as > data buffers. I am stuck with the following code line, which works on > Python 2, but not on

array and strings in Python 3

2010-12-11 Thread wander.lairson
Hello, This is my first post on python mailing list. I've working in code which must run on python 2 and python 3. I am using array.array as data buffers. I am stuck with the following code line, which works on Python 2, but not on Python 3.1.2: >>> import array >>> array.array('B', 'test') Trace

Re: Catching user switching and getting current active user from root on linux

2010-12-11 Thread Steven D'Aprano
On Sat, 11 Dec 2010 11:43:13 -0800, mpnordland wrote: > sorry, I've been busy, it's on linux, and current active user is the > user currently using the computer. My program needs to switch log files > when a different user starts using the computer. I think you have missed what people are trying

Re: Ways of accessing this mailing list?

2010-12-11 Thread Martin Schoeoen
On 2010-11-04, Mark Wooding wrote: > John Bond writes: > >> Hope this isn't too O/T - I was just wondering how people read/send to >> this mailing list, eg. normal email client, gmane, some other software >> or online service? >> >> My normal inbox is getting unmanageable, and I think I need to f

Re: Enabling the use of POSIX character classes in Python

2010-12-11 Thread Perry Johnson
On 2010-12-11, MRAB wrote: > On 11/12/2010 17:33, Perry Johnson wrote: >> Python's re module does not support POSIX character classes, for >> example [:alpha:]. It is, of course, trivial to simulate them using >> character ranges when the text to be matched uses the ASCII character >> set. Sadly,

Re: Bind C++ program for use with both Python 2.x and 3.x

2010-12-11 Thread Martin v. Loewis
Am 11.12.2010 23:41, schrieb Peter C.: > Hello, I am looking at the possibility of making a program in C++. The > catch is it will require the ability to work with binding for use with > scripting in both Python 2.x and 3.x for various tool plugins. Is > there any way to bind a C++ app to work with

Bind C++ program for use with both Python 2.x and 3.x

2010-12-11 Thread Peter C.
Hello, I am looking at the possibility of making a program in C++. The catch is it will require the ability to work with binding for use with scripting in both Python 2.x and 3.x for various tool plugins. Is there any way to bind a C++ app to work with both Python 2.x and 3.x using the Python C API

Re: Catching user switching and getting current active user from root on linux

2010-12-11 Thread Tim Harig
Mr. Chase, I really wouldn't even bother wasting my time on this one. He asked an incomplete question to start with; so, the replies that he received were insufficient to solve his problem. He still has not provided enough information to know how to answer his question propery. He doesn't understa

Re: python-parser running Beautiful Soup needs to be reviewed

2010-12-11 Thread Alexander Kapps
On 11.12.2010 22:38, Stef Mientki wrote: On 11-12-2010 17:24, Martin Kaspar wrote: Hello commnity i am new to Python and to Beatiful Soup also! It is told to be a great tool to parse and extract content. So here i am...: I want to take the content of a-tag of a table in a html document. For ex

Re: python-parser running Beautiful Soup needs to be reviewed

2010-12-11 Thread Peter Pearson
On Sat, 11 Dec 2010 22:38:43 +0100, Stef Mientki wrote: [snip] > So the simplest solution I came up with: > > Text = """ > > > > This is a sample text > > > > This is the second sample text > > >

Re: python-parser running Beautiful Soup needs to be reviewed

2010-12-11 Thread Stef Mientki
On 11-12-2010 17:24, Martin Kaspar wrote: > Hello commnity > > i am new to Python and to Beatiful Soup also! > It is told to be a great tool to parse and extract content. So here i > am...: > > I want to take the content of a -tag of a table in a html > document. For example, i have this table > >

Re: Catching user switching and getting current active user from root on linux

2010-12-11 Thread Tim Chase
On 12/11/2010 01:43 PM, mpnordland wrote: it's on linux, and current active user is the user currently using the computer. My program needs to switch log files when a different user starts using the computer. The problem is that multiple users can be logged on at the same time. You might be a

Re: Making os.unlink() act like "rm -f"

2010-12-11 Thread Roy Smith
In article , Christian Heimes wrote: > Am 11.12.2010 18:04, schrieb Roy Smith: > > if os.access("file", os.F_OK): > >os.unlink("file") > > > > but that's annoying too. What would people think about a patch to > > os.unlink() to add an optional second parameter which says to ignore > > at

Re: Python distribution recommendation?

2010-12-11 Thread Steve Holden
On 12/11/2010 9:31 AM, Octavian Rasnita wrote: > Ok, thank you all for your recommendations. > > I think I will install ActivePython because it seems that it offers more > features for Windows programming than the other distro (by default, which is > important for a beginner). > > I will use Wx

Re: Python critique

2010-12-11 Thread Steve Holden
On 12/11/2010 6:46 AM, Lie Ryan wrote: > Also, class scope and instance scope, though similar, are distinct > scopes. Python also have the hidden interpreter-level scope (the > __builtins__). Kindly ignore my last post. Class scopes are lexical, instance scopes are not. regards Steve -- Steve H

Re: Python critique

2010-12-11 Thread Steve Holden
On 12/11/2010 6:46 AM, Lie Ryan wrote: > On 12/11/10 11:37, Dan Stromberg wrote: >> On Fri, Dec 10, 2010 at 3:51 PM, John Nagle wrote: >>> On 12/10/2010 3:25 PM, Stefan Behnel wrote: Benjamin Kaplan, 11.12.2010 00:13: > On Fri, Dec 10, 2010 at 5:46 PM, Octavian Rasnita wrote: > The on

Re: Catching user switching and getting current active user from root on linux

2010-12-11 Thread mpnordland
about the pyutmp, is the most recent entry at the top or bottom of the file? -- http://mail.python.org/mailman/listinfo/python-list

Re: Catching user switching and getting current active user from root on linux

2010-12-11 Thread mpnordland
sorry, I've been busy, it's on linux, and current active user is the user currently using the computer. My program needs to switch log files when a different user starts using the computer. -- http://mail.python.org/mailman/listinfo/python-list

Re: ctypes question

2010-12-11 Thread MrJean1
It is not entirely clear what the functions and especially what their signatures are in that C library clibsmi. In general, for shared libraries, you need to define those first as prototype using ctypes.CFUNCTYPE() and then instantiate each prototype once supplying the necessary parameter flags us

Re: how to read o/p of telenet (python) ?!

2010-12-11 Thread MRAB
On 11/12/2010 17:44, Ian Kelly wrote: On 12/11/2010 4:20 AM, Darshak Bavishi wrote: i have code to telnet remote machine (unix) i am using port 5400 to telnet but o/p is not in visible format when i run random commands or run What is "o/p"? [snip] "o/p" is an abbreviation for "output" (and

Re: Enabling the use of POSIX character classes in Python

2010-12-11 Thread Martin v. Loewis
Am 11.12.2010 18:33, schrieb Perry Johnson: > Python's re module does not support POSIX character classes, for > example [:alpha:]. It is, of course, trivial to simulate them using > character ranges when the text to be matched uses the ASCII character > set. Sadly, my problem is that I need to pro

Re: Enabling the use of POSIX character classes in Python

2010-12-11 Thread MRAB
On 11/12/2010 17:33, Perry Johnson wrote: Python's re module does not support POSIX character classes, for example [:alpha:]. It is, of course, trivial to simulate them using character ranges when the text to be matched uses the ASCII character set. Sadly, my problem is that I need to process Uni

Re: how to read o/p of telenet (python) ?!

2010-12-11 Thread Ian Kelly
On 12/11/2010 4:20 AM, Darshak Bavishi wrote: i have code to telnet remote machine (unix) i am using port 5400 to telnet but o/p is not in visible format when i run random commands or run What is "o/p"? when i give as read_some() it displays some lines but in case of read_all() it gets hang !

Enabling the use of POSIX character classes in Python

2010-12-11 Thread Perry Johnson
Python's re module does not support POSIX character classes, for example [:alpha:]. It is, of course, trivial to simulate them using character ranges when the text to be matched uses the ASCII character set. Sadly, my problem is that I need to process Unicode text. The re module has its own charact

Re: Making os.unlink() act like "rm -f"

2010-12-11 Thread Godson Gera
On Sat, Dec 11, 2010 at 10:34 PM, Roy Smith wrote: > os.unlink("file", ignore=True) > -- > http://mail.python.org/mailman/listinfo/python-list > Take a look at shutil.rmtree http://docs.python.org/library/shutil.html?highlight=shutil#shutil.rmtree -- Thanks & Regards, Godson Gera Python Consu

Re: Making os.unlink() act like "rm -f"

2010-12-11 Thread Nobody
On Sat, 11 Dec 2010 12:04:01 -0500, Roy Smith wrote: > I just wrote an annoying little piece of code: > > try: > os.unlink("file") > except OSError: >pass > > The point being I want to make sure the file is gone, but am not sure if > it exists currently. Essentially, I want to do what "

Re: Making os.unlink() act like "rm -f"

2010-12-11 Thread Christian Heimes
Am 11.12.2010 18:04, schrieb Roy Smith: > if os.access("file", os.F_OK): >os.unlink("file") > > but that's annoying too. What would people think about a patch to > os.unlink() to add an optional second parameter which says to ignore > attempts to remove non-existent files (just like "rm -f"

Making os.unlink() act like "rm -f"

2010-12-11 Thread Roy Smith
I just wrote an annoying little piece of code: try: os.unlink("file") except OSError: pass The point being I want to make sure the file is gone, but am not sure if it exists currently. Essentially, I want to do what "rm -f" does in the unix shell. In fact, what I did doesn't even do th

Re: python-parser running Beautiful Soup needs to be reviewed

2010-12-11 Thread Nitin Pawar
try using lxml ... its very useful On Sat, Dec 11, 2010 at 11:24 AM, Martin Kaspar wrote: > Hello commnity > > i am new to Python and to Beatiful Soup also! > It is told to be a great tool to parse and extract content. So here i > am...: > > I want to take the content of a -tag of a table in a h

python-parser running Beautiful Soup needs to be reviewed

2010-12-11 Thread Martin Kaspar
Hello commnity i am new to Python and to Beatiful Soup also! It is told to be a great tool to parse and extract content. So here i am...: I want to take the content of a -tag of a table in a html document. For example, i have this table This is a sample te

Integrating doctest with unittest

2010-12-11 Thread Steven D'Aprano
I have a module with doctests, and a module that performs unit testing for it. The test module looks like this: import doctest import unittest import module_to_test # ... # many test suites # ... if __name__ == '__main__': doctest.testmod(module_to_test) unittest.main() but now I'd

Re: 64 bit memory usage

2010-12-11 Thread Steve Holden
On 12/10/2010 2:03 PM, Rob Randall wrote: > I manged to get my python app past 3GB on a smaller 64 bit machine. > On a test to check memory usage with gc disabled only an extra 6MB was > used. > The figures were 1693MB to 1687MB. > > This is great. > > Thanks again for the help. Do remember, tho

Re: Python distribution recommendation?

2010-12-11 Thread Octavian Rasnita
Ok, thank you all for your recommendations. I think I will install ActivePython because it seems that it offers more features for Windows programming than the other distro (by default, which is important for a beginner). I will use WxPython and not other GUIS like QT, Tk or GTK because they are

Re: instance has no __call__ method

2010-12-11 Thread Steve Holden
On 12/10/2010 5:20 AM, frank cui wrote: > Hi all, > > I'm a novice learner of python and get caught in the following trouble > and hope experienced users can help me solve it:) > > Code: > --- > $ cat Muffle_ZeroDivision.py > #!/

Re: Python distribution recommendation?

2010-12-11 Thread Godson Gera
On Sat, Dec 11, 2010 at 6:13 PM, Octavian Rasnita wrote: > > > I am especially interested in creating MS Windows apps with Python. > If you want to access win32api and do some COM programming then ActiveState comes bundled with pywin32. Where in vanilla python distro you have to install those pac

Re: Python distribution recommendation?

2010-12-11 Thread Lie Ryan
On 12/11/10 23:43, Octavian Rasnita wrote: > Hi, > > Is there a "recommended" Python distribution for Windows XP? > > I know about the one that can be downloaded from python.org (which I am using > for the moment) and the one offered by ActiveState but I don't know which one > is better for a b

Re: Python distribution recommendation?

2010-12-11 Thread Katie T
On Sat, Dec 11, 2010 at 12:43 PM, Octavian Rasnita wrote: > Hi, > > Is there a "recommended" Python distribution for Windows XP? Either will work, although the python.org one is the more popular and is likely the one used by most tutorials and beginners guides. The ActiveState one bundles PyQT if

Python distribution recommendation?

2010-12-11 Thread Octavian Rasnita
Hi, Is there a "recommended" Python distribution for Windows XP? I know about the one that can be downloaded from python.org (which I am using for the moment) and the one offered by ActiveState but I don't know which one is better for a beginner nor if there are other distributions available.

Re: Python critique

2010-12-11 Thread Lie Ryan
On 12/11/10 11:37, Dan Stromberg wrote: > On Fri, Dec 10, 2010 at 3:51 PM, John Nagle wrote: >> On 12/10/2010 3:25 PM, Stefan Behnel wrote: >>> Benjamin Kaplan, 11.12.2010 00:13: On Fri, Dec 10, 2010 at 5:46 PM, Octavian Rasnita wrote: The only scopes Python has are module and function.

how to read o/p of telenet (python) ?!

2010-12-11 Thread Darshak Bavishi
hi experts , i have code to telnet remote machine (unix) i am using port 5400 to telnet but o/p is not in visible format when i run random commands or run when i give as read_some() it displays some lines but in case of read_all() it gets hang !! In actual i want to get some string from o/p and

Re: run a function in another processor in python

2010-12-11 Thread Peter Otten
Astan Chee wrote: > Sorry about that, here is a summary of my complete code. I haven't cleaned > it up much or anything, but this is what it does: > > import time > import multiprocessing > > test_constx =0 > test_consty =0 > > def functionTester(x): > global test_constx You don't need to de

Re: Python critique

2010-12-11 Thread Octavian Rasnita
From: "Steven D'Aprano" ... >> Can you please tell me how to write the following program in Python? >> >> my $n = 1; >> >> { >> my $n = 2; >> print "$n\n"; >> } >> >> print "$n\n"; >> >> If this program if ran in Perl, it prints: >> 2 >> 1 > > Lots of ways. Here's one: > > > n = 1 > >