helo

2010-05-19 Thread cosmeticsafrolatino
hi -- http://mail.python.org/mailman/listinfo/python-list

Re: How to unescape a raw string?

2010-05-19 Thread Gary Herron
On 05/19/2010 08:34 PM, pyt...@bdurham.com wrote: How can I unescape a raw string so that it behaves as a non-raw string? For example, if I read the string "\n\t A B C\" D E F \xa0 \u1234" from a text file, how can I convert (unescape?) this string so that \n, \t, \", \x, and \u get converted t

Re: What's the matter with docs.python.org?

2010-05-19 Thread Christian Mertes
On Mi, 2010-05-19 at 16:42 -0700, Aahz wrote: > > IPv6 has sometimes been problematical -- try disabling it. Wow, can I have that on a t-shirt? ;) > Also, I think you need to pass the host HTTP header to access > docs.python.org Look, I don't really want to read Python docs via telnet. I basica

Re: Loading C extension from memory

2010-05-19 Thread Christian Heimes
mk wrote: I wonder if there is a way to load C extension from in-memory object, not from the file on the disk? No, that's not possible since Python depends on the operating system. A lot of operating systems require a physical file to load the shared library from. Python uses dlopen() on most

Re: Loading C extension from memory

2010-05-19 Thread Roger Binns
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 05/13/2010 06:14 AM, mk wrote: > I wonder if there is a way to load C extension from in-memory object, > not from the file on the disk? > > I'm asking bc I would like to download C extensions over network and > load them into Python interpreter (wi

error importing numpy

2010-05-19 Thread sanam singh
Hi, when i import numpy in python i get following error : Python 2.6.5 (r265:79063, May 2 2010, 10:47:11) [GCC 4.3.3] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import numpy Traceback (most recent call last): File "", line 1, in ImportError: No modu

Re: Display file names in Tkinter Listbox

2010-05-19 Thread John McMonagle
r...@home.com wrote: > Hello, > > My first attenpt at a simple python Tkinter application. I wanted to > see how to load file names into a listbox from a menu. This is what I > got until the part of displaying the file names in a listbox, which I > could not figfure out how to do? > > Any help w

Re: help need to write a python spell checker

2010-05-19 Thread alex23
Patrick Maupin wrote: > Although it makes > perfect sense, I never really thought much about the possibility that > the school year would be "upside down" "down under"... Yes, having the school year run within the actual year instead of across two is such a topsy-turvy concept, it's pretty obviou

Re: Newbie Alert: subprocess.call

2010-05-19 Thread Patrick Maupin
On May 19, 10:28 pm, Ben Finney wrote: > Better is to use ‘shlex.split’ to split the string as a shell parser > would do http://docs.python.org/library/shlex#shlex.split>. Good point. I always forget about shlex.split because I'm usually passing (relatively) constant strings with no funny quoti

Re: How to unescape a raw string?

2010-05-19 Thread python
Hi Chris, > That's not what the notion of raw strings in Python technically means, but > anyway... Agree - I was having a difficult time trying to describe my dilemma - thanks for hanging in there with my rather awkward intro :) > I'll assume you're quoting the file contents itself verbatim her

Best practice for string substition with gettext

2010-05-19 Thread python
Looking for best practice advice on what string substitution technique to use when using gettext(). Or do all techniques apply equally? I can think of at least 3 string techniques: 1. Classic "%" based formatting: "My name is %(name)s" % locals() 2. .format() based formatting: "My name is {nam

Re: function that counts...

2010-05-19 Thread John Posner
On 5/19/2010 5:51 PM, Steven D'Aprano wrote: On Wed, 19 May 2010 21:58:04 +0200, superpollo wrote: Rather than iterating over an index j = 0, 1, 2, ... and then fetching the jth character of the string, you can iterate over the characters directly. So the inner loop is better written: for c in

Re: How to unescape a raw string?

2010-05-19 Thread Chris Rebert
On Wed, May 19, 2010 at 8:34 PM, wrote: > How can I unescape a raw string so that it behaves as a non-raw string? That's not what the notion of raw strings in Python technically means, but anyway... > For example, if I read the string "\n\t A B C\" D E F \xa0 \u1234" I'll assume you're quoting

Re: Newbie Alert: subprocess.call

2010-05-19 Thread Chris Rebert
On Wed, May 19, 2010 at 7:27 PM, Carbon wrote: > I am new to Python and am trying to write a GUI wrapper script in python > 2.5 to get username and passwords from Linux users to send as options to > run an app on a 2X terminal server. I came across the easygui module and > its multpasswordbox func

How to unescape a raw string?

2010-05-19 Thread python
How can I unescape a raw string so that it behaves as a non-raw string? For example, if I read the string "\n\t A B C\" D E F \xa0 \u1234" from a text file, how can I convert (unescape?) this string so that \n, \t, \", \x, and \u get converted to a newline, tab, double quote, hex encoded and unico

Re: Newbie Alert: subprocess.call

2010-05-19 Thread Ben Finney
Patrick Maupin writes: > On May 19, 9:27 pm, Carbon wrote: > > subprocess.call(["/opt/2X/Client/bin/appserverclient", "-u > > fieldValues [0]", "-p fieldValues[1]", "-s ts.mycompany.org:80", "-d > > corp", "-S local", "-c 16", "-e 0xF", "-l 0x0409", "-a #1"]) As Patrick says, you need to give t

Re: Newbie Alert: subprocess.call

2010-05-19 Thread Patrick Maupin
On May 19, 9:27 pm, Carbon wrote: > I am new to Python and am trying to write a GUI wrapper script in python > 2.5 to get username and passwords from Linux users to send as options to > run an app on a 2X terminal server. I came across the easygui module and > its multpasswordbox function, which m

Newbie Alert: subprocess.call

2010-05-19 Thread Carbon
I am new to Python and am trying to write a GUI wrapper script in python 2.5 to get username and passwords from Linux users to send as options to run an app on a 2X terminal server. I came across the easygui module and its multpasswordbox function, which made popping a dialog box and storing th

Re: function that counts...

2010-05-19 Thread Richard Thomas
For this kind of problem you should avoid all that stringification. I find it best to deal with sequences of digits of a fixed length and go from there. For example: def count1(m, n, cache={}): """Number of digit sequences of length `n` summing to `m`.""" if n < 0 or m < 0: return

Display file names in Tkinter Listbox

2010-05-19 Thread Rick
Hello, My first attenpt at a simple python Tkinter application. I wanted to see how to load file names into a listbox from a menu. This is what I got until the part of displaying the file names in a listbox, which I could not figfure out how to do? Any help would be appreciated. Trying to do thi

Fwd: question on logging module - solved

2010-05-19 Thread frank zhu
FYI. -- Forwarded message -- From: Cameron Simpson Date: Wed, May 19, 2010 at 6:18 PM Subject: Re: question on logging module To: frank zhu On 19May2010 11:55, frank zhu wrote: | Thanks Cameron. That was the problem. I copied the sample code and named it | logging.py. which wa

Re: compile() error

2010-05-19 Thread Jerry Hill
On Wed, May 19, 2010 at 8:52 PM, Steven D'Aprano wrote: > On Wed, 19 May 2010 22:31:31 +, Benjamin Peterson wrote: >> Iuri gmail.com> writes: >>> Any ideas about what is happening? >> >> Until Python 2.7/3.2, compile() does't like sources which don't end in a >> newline. It appears to be thi

Re: compile() error

2010-05-19 Thread Iuri
Steven, it works fine to some cases. I have problem only when last line is a comment and before it I have an indentation. It is a specific case, and it is not a common case. >>> compile("for i in [1,2,3]:\n pass\n#end", "test_file.py", "exec") What I understanded about Benjamin's answer is compi

links button gone from python.org

2010-05-19 Thread eric_dex...@msn.com
I noticed that that the link to that section is gone. The page seems to be there when I use the url that is stored on my computer. Unrelated but I will mention that It is sad to see that dr dobs python newsletter has vanished, I enjoyed reading that from time to time. -- http://mail.python.o

Re: compile() error

2010-05-19 Thread Steven D'Aprano
On Wed, 19 May 2010 22:31:31 +, Benjamin Peterson wrote: > Iuri gmail.com> writes: >> Any ideas about what is happening? > > Until Python 2.7/3.2, compile() does't like sources which don't end in a > newline. Are you sure about that? >>> x = compile("print __import__('sys').version, 'see

Re: ipython question

2010-05-19 Thread Terry Reedy
On 5/19/2010 4:14 PM, superpollo wrote: In [219]: %save tmp.py 218 File `tmp.py` exists. Overwrite (y/[N])? y The following commands were written to file `tmp.py`: def f(): return 42 In [220]: !cat tmp.py def f(): return 42 In [221]: %psource f No source found for f maybe i got it: In [230

Re: abc for generators?

2010-05-19 Thread Carl Banks
On May 19, 2:27 pm, Alan Franzoni wrote: > On 5/19/10 7:24 PM, Carl Banks wrote: > > > collections.Iterator > > That would just support the next() method. But enhanced generators > interface - supporting coroutines as well - include send(), throw() and > close(). Hmm, don't know. Maybe you could

KaPy -- Karlsruhe Python User Group meeting, 2010-05-21, 19:00

2010-05-19 Thread Jürgen Erhard
The Karlsruhe Python User Group (KaPy) meets again. Friday, 2010-04-16 (May 21st) at 19:00 (7pm) in the rooms of Entropia eV (the local affiliate of the CCC). See http://entropia.de/wiki/Anfahrt on how to get there. For your calendars: meetings are held monthly, on the 3rd Friday. Bye, J PS: S

Re: What's the matter with docs.python.org?

2010-05-19 Thread Aahz
In article , Christian Mertes wrote: > > $ telnet docs.python.org 80 > Trying 2001:888:2000:d::a2... > Trying 82.94.164.162... > Connected to docs.python.org. > Escape character is '^]'. IPv6 has sometimes been problematical -- try disabling it. Also, I think you need to pass the host HTTP head

Re: Classes and threading

2010-05-19 Thread Aahz
In article , Christian Heimes wrote: >> >> class nThread(threading.Thread): >> def __init__(self, *args, **kwds): >> threading.Thread.__init__(self, *args, **kwds) >> # your other stuff here > >Since Thread is a new style class, this should read: > >class NThre

Re: What's the matter with docs.python.org?

2010-05-19 Thread Rhodri James
On Wed, 19 May 2010 17:23:18 +0100, Christian Mertes wrote: I reported docs.python.org as a broken page to the Opera devs but I'm also Ccing this mail to the server admin because this seems to be a more complex problem than just a broken (if at all) web browser. It's been working fine f

client server console app with cmd library

2010-05-19 Thread kak...@gmail.com
Hi to all, i need some hints about a console application i' m trying. I want to make it act as a client and as a server at a same time. And since it is a console application i' m using cmd library. I want something that works like asterisk. while working with my app i want to listen for incoming re

Re: Python Script for Website Mirroring

2010-05-19 Thread Christian Mertes
On Mi, 2010-05-19 at 16:35 -0600, Vincent Davis wrote: > If it is a simple site you could just transfer with ftp Or rsync -a or wget -m ... like tools that were specifically made for this task. Therefore something like subprocess.call(["rsync", "-az", "-e", "ssh", "--delete", source, target]) sh

Re: compile() error

2010-05-19 Thread Iuri
Thanks, Benjamin. I used Python 2.6 to these tests. []s iuri On Wed, May 19, 2010 at 7:31 PM, Benjamin Peterson wrote: > Iuri gmail.com> writes: > > Any ideas about what is happening? > > Until Python 2.7/3.2, compile() does't like sources which don't end in a > newline. > > > > -- > http://m

Re: Python Script for Website Mirroring

2010-05-19 Thread Vincent Davis
Probably need a little more info to help. Are you running both sites, are there database involved? If it is a simple site you could just transfer with ftp and have the script updated any urls. Vincent On Wed, May 19, 2010 at 8:21 AM, Kevin Rea wrote: > Hello Folks: > > Can you please point

Re: compile() error

2010-05-19 Thread Benjamin Peterson
Iuri gmail.com> writes: > Any ideas about what is happening? Until Python 2.7/3.2, compile() does't like sources which don't end in a newline. -- http://mail.python.org/mailman/listinfo/python-list

compile() error

2010-05-19 Thread Iuri
>>> compile("for i in [1,2,3]:\n pass\n#end\n", "test_file.py", "exec") at 0x266a378, file "test_file.py", line 1> >>> compile("for i in [1,2,3]:\n pass\n#end", "test_file.py", "exec") Traceback (most recent call last): File "", line 1, in File "", line 2, in cptest File "test_file.py", line 3 #e

Re: struct

2010-05-19 Thread Gary Herron
On 05/19/2010 02:53 PM, Back9 wrote: Can anyone explain the difference between f and d in struct unpack? When using them, some data work in either one not both. To me it seems to be same, TIA 'f' is single precision float (32 bits), and 'd' is a double precision float (64 bits) Gary Herr

struct

2010-05-19 Thread Back9
Can anyone explain the difference between f and d in struct unpack? When using them, some data work in either one not both. To me it seems to be same, TIA -- http://mail.python.org/mailman/listinfo/python-list

Re: function that counts...

2010-05-19 Thread Steven D'Aprano
On Wed, 19 May 2010 21:58:04 +0200, superpollo wrote: > ... how many positive integers less than n have digits that sum up to m: > > In [197]: def prttn(m, n): Does the name "prttn" mean anything? I'm afraid I keep reading it as a mispelling of "print n". [...] > s = str(i) >

Re: function that counts...

2010-05-19 Thread Steven D'Aprano
On Wed, 19 May 2010 22:58:22 +0200, superpollo wrote: > In [266]: del(sum) del is a statement, not a function, so the brackets are pointless. This is like writing: x = (1) instead of x = 1 `del sum` is all you need. -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: abc for generators?

2010-05-19 Thread Alan Franzoni
On 5/19/10 7:24 PM, Carl Banks wrote: > collections.Iterator That would just support the next() method. But enhanced generators interface - supporting coroutines as well - include send(), throw() and close(). -- Alan Franzoni contact me at pub...@[mysurname].eu -- http://mail.python.org/mailma

Re: function that counts...

2010-05-19 Thread René 'Necoro' Neumann
Am 19.05.2010 22:58, schrieb superpollo: > > In [277]: prttn(25, 1) > Out[277]: 348 > > In [278]: prttn2(25, 1) > Out[278]: 348 > > In [279]: prttn3(25, 1) > Out[279]: 348 > > ok, bye! Just because I was curios: nec...@zakarumiy ~ % python -m timeit "import test; test.prttn(25,100

Re: function that counts...

2010-05-19 Thread superpollo
Mark Dickinson ha scritto: On May 19, 9:30 pm, superpollo wrote: René 'Necoro' Neumann ha scritto: An idea would be: def prttn(m, n): ...return sum(1 for x in range(n) if sum(map(int, str(x))) == m) TypeError: 'int' object is not callable on 2.5.4 The TypeError is almost certainl

Re: function that counts...

2010-05-19 Thread superpollo
Jerry Hill ha scritto: On Wed, May 19, 2010 at 4:25 PM, superpollo wrote: Jerry Hill ha scritto: sumofdigits = sum(int(char) for char in str(testval)) this line gives me this: TypeError: 'int' object is not callable is it some new feature in >2.5 ? No, sum() has been a builtin sinc

Re: function that counts...

2010-05-19 Thread Mark Dickinson
On May 19, 9:30 pm, superpollo wrote: > René 'Necoro' Neumann ha scritto: > > An idea would be: > > def prttn(m, n): > > ...        return sum(1 for x in range(n) if sum(map(int, str(x))) == m) > > TypeError: 'int' object is not callable > > on 2.5.4 The TypeError is almost certainly because

Re: function that counts...

2010-05-19 Thread Jerry Hill
On Wed, May 19, 2010 at 4:25 PM, superpollo wrote: > Jerry Hill ha scritto: >>        sumofdigits = sum(int(char) for char in str(testval)) > > this line gives me this: > > TypeError: 'int' object is not callable > > is it some new feature in >2.5 ? No, sum() has been a builtin since Python 2.3.

Re: Installing Lightweight Python

2010-05-19 Thread News123
Nima Mohammadi wrote: > Well, I tried to run Python with -v option. It seems that python26.zip > is partially loaded but can't be used, because zlib is "unavailable". This is normal. the zip library itself cannot be zipped, as it is needed to unzip and extract th other libs. > > n...@nima-deskt

Re: function that counts...

2010-05-19 Thread superpollo
René 'Necoro' Neumann ha scritto: Am 19.05.2010 21:58, schrieb superpollo: ... how many positive integers less than n have digits that sum up to m: In [197]: def prttn(m, n): tot = 0 for i in range(n): s = str(i) sum = 0 for j in range(len(s)): sum +=

Re: function that counts...

2010-05-19 Thread superpollo
Jerry Hill ha scritto: On Wed, May 19, 2010 at 3:58 PM, superpollo wrote: ... how many positive integers less than n have digits that sum up to m: ... any suggestion for pythonizin' it? This is how I would do it: def prttn(m, n): """How many positive integers less than n have digits th

Re: function that counts...

2010-05-19 Thread René 'Necoro' Neumann
Am 19.05.2010 21:58, schrieb superpollo: > ... how many positive integers less than n have digits that sum up to m: > > In [197]: def prttn(m, n): > tot = 0 > for i in range(n): > s = str(i) > sum = 0 > for j in range(len(s)): > sum += int(s[j]) >

Re: ipython question

2010-05-19 Thread Robert Kern
On 5/19/10 3:10 PM, superpollo wrote: Robert Kern ha scritto: On 5/19/10 12:11 PM, superpollo wrote: In [39]: def f(): : return 42 : In [40]: %psource f No source found for f In [41]: i expected to see the source... You will want to ask IPython questions on the IPython mailing list

Re: ipython question

2010-05-19 Thread superpollo
superpollo ha scritto: Robert Kern ha scritto: On 5/19/10 12:11 PM, superpollo wrote: In [39]: def f(): : return 42 : In [40]: %psource f No source found for f In [41]: i expected to see the source... You will want to ask IPython questions on the IPython mailing list: http://mai

Re: ipython question

2010-05-19 Thread superpollo
Robert Kern ha scritto: On 5/19/10 12:11 PM, superpollo wrote: In [39]: def f(): : return 42 : In [40]: %psource f No source found for f In [41]: i expected to see the source... You will want to ask IPython questions on the IPython mailing list: http://mail.scipy.org/mailman/list

Re: function that counts...

2010-05-19 Thread Jerry Hill
On Wed, May 19, 2010 at 3:58 PM, superpollo wrote: > ... how many positive integers less than n have digits that sum up to m: ... > any suggestion for pythonizin' it? This is how I would do it: def prttn(m, n): """How many positive integers less than n have digits that sum up to m""" tot

Re: ipython question

2010-05-19 Thread Robert Kern
On 5/19/10 12:11 PM, superpollo wrote: In [39]: def f(): : return 42 : In [40]: %psource f No source found for f In [41]: i expected to see the source... You will want to ask IPython questions on the IPython mailing list: http://mail.scipy.org/mailman/listinfo/ipython-user The re

function that counts...

2010-05-19 Thread superpollo
... how many positive integers less than n have digits that sum up to m: In [197]: def prttn(m, n): tot = 0 for i in range(n): s = str(i) sum = 0 for j in range(len(s)): sum += int(s[j]) if sum == m: tot += 1 return tot .:

Re: how to preserve hex value

2010-05-19 Thread J. Cliff Dyer
On Wed, 2010-05-19 at 11:38 -0700, Back9 wrote: > Hi, > > When converting a hex value, I'd like to preserve the decimal > position. > For example, 0x0A is converted to 0A not just A in string. > > How do I do this? > > TIA I'm not sure I understand what your use case is, but generally speaking,

Re: how to preserve hex value

2010-05-19 Thread member thudfoo
On Wed, May 19, 2010 at 11:38 AM, Back9 wrote: > Hi, > > When converting a hex value, I'd like to preserve the decimal > position. > For example, 0x0A is converted to 0A not just A in string. > > How do I do this? > > TIA > -- > http://mail.python.org/mailman/listinfo/python-list > |109> '%02X' %

Re: Delete files from FTP Server older then 7 days. Using ftputil and ftplib.

2010-05-19 Thread Giampaolo Rodolà
2010/5/19 pilgrim773 : > Hello I am new to Python programming. I need a write a script which > will delete files from a FTP server after they have reached a certain > age, like 7 days for example. I have prepared this code below, but I > get an error message: > The system cannot find the path speci

how to preserve hex value

2010-05-19 Thread Back9
Hi, When converting a hex value, I'd like to preserve the decimal position. For example, 0x0A is converted to 0A not just A in string. How do I do this? TIA -- http://mail.python.org/mailman/listinfo/python-list

Re: What's the matter with docs.python.org?

2010-05-19 Thread Christian Mertes
On Mi, 2010-05-19 at 09:54 -0700, member thudfoo wrote: > Worked for me: > > ~/isos2burn> telnet docs.python.org 80 > Trying 82.94.164.162... > Connected to docs.python.org. > Escape character is '^]'. > GET/HTTP/1.0 > > > 302 Found > > Found > The document has moved http://www.python.org";>he

Re: Best XML python package to learn for Ubuntu Linux ?

2010-05-19 Thread Philip Semanchuk
On May 19, 2010, at 1:54 PM, Robert Somerville wrote: Hi; I am about to get my feet wet with Python XML, there appears to be many libraries ... can someone recommend a good package to use on Ubuntu ??? Hi Robert, xml.etree.ElementTree is in the Python standard library as of version 2.5.

Best XML python package to learn for Ubuntu Linux ?

2010-05-19 Thread Robert Somerville
Hi; I am about to get my feet wet with Python XML, there appears to be many libraries ... can someone recommend a good package to use on Ubuntu ??? regards; Robert Somerville -- http://mail.python.org/mailman/listinfo/python-list

Re: abc for generators?

2010-05-19 Thread Carl Banks
On May 19, 8:42 am, Alan Franzoni wrote: > Hello, > I was looking for an ABC for generators in python. While there's a > types.GeneratorType type object - which can't be used directly  and it's > not an abc - and many collections-related ABCs in the collections > module, there's no way to say a us

Re: another question about classes and subclassing

2010-05-19 Thread cjw
On 18-May-10 17:51 PM, Alex Hall wrote: Hi again all, More about classes. I am still looking into my battleship game, and I will have several different craft. All craft have common attribs (position, alive, and so on) but each craft may be a surface ship, submarine, or airplane. All three are cra

Re: Access to comp.lang.python

2010-05-19 Thread cjw
On 18-May-10 19:27 PM, Tim Chase wrote: On 05/15/2010 05:34 PM, cjw wrote: It seems that messages are coming from a number of sources, such as gmane and google groups. The problem is that many messages seem to get unlinked from their threads. I use Thunderbird 3.0.5 and wonder whether the prob

ipython question

2010-05-19 Thread superpollo
In [39]: def f(): : return 42 : In [40]: %psource f No source found for f In [41]: i expected to see the source... -- http://mail.python.org/mailman/listinfo/python-list

Re: how to cause a request for a missing class attribute cause its calculation

2010-05-19 Thread John Posner
On 5/18/2010 4:54 PM, Chris Rebert wrote: Suggested reading: http://docs.python.org/library/functions.html#property I've placed a revision to this official *property* documentation at: http://wiki.python.org/moin/AlternativeDescriptionOfProperty There's also a gentle (I hope) intro to t

Re: How to determine subprocess.Popen() failed when shell=True

2010-05-19 Thread python
For the archives - solution posted at http://stackoverflow.com/questions/2861548/how-to-determine-subprocess-popen-failed-when-shelltrue Malcolm -- http://mail.python.org/mailman/listinfo/python-list

Re: What's the matter with docs.python.org?

2010-05-19 Thread member thudfoo
On Wed, May 19, 2010 at 9:23 AM, Christian Mertes wrote: > by kjon 2010-03-24T16:40:21+00:00. >> In Philip Semanchuk writes: >> >On Mar 24, 2010, at 12:05 PM, kj wrote: >> >> In the last couple of weeks, docs.python.org has been down repeatedly >> >> (like right now). Has anyone else noticed this?

Re: What's the matter with docs.python.org?

2010-05-19 Thread Christian Mertes
by kjon 2010-03-24T16:40:21+00:00. > In Philip Semanchuk writes: > >On Mar 24, 2010, at 12:05 PM, kj wrote: > >> In the last couple of weeks, docs.python.org has been down repeatedly > >> (like right now). Has anyone else noticed this? > >http://downforeveryoneorjustme.com/docs.python.org > Very h

Re: Discover PyH

2010-05-19 Thread Michel Claveau - MVP
Bonsoir ! La démarche me semble intéressante. Je testerai le module quand j'aurai un peu de temps. @-salutations -- Michel Claveau -- http://mail.python.org/mailman/listinfo/python-list

abc for generators?

2010-05-19 Thread Alan Franzoni
Hello, I was looking for an ABC for generators in python. While there's a types.GeneratorType type object - which can't be used directly and it's not an abc - and many collections-related ABCs in the collections module, there's no way to say a user-defined class as a generator, even though it coul

Re: Delete files from FTP Server older then 7 days. Using ftputil and ftplib.

2010-05-19 Thread MRAB
pilgrim773 wrote: Hello I am new to Python programming. I need a write a script which will delete files from a FTP server after they have reached a certain age, like 7 days for example. I have prepared this code below, but I get an error message: The system cannot find the path specified: '/test1

Re: remove elements incrementally from a list

2010-05-19 Thread Javier Montoya
On May 19, 4:06 pm, Steven D'Aprano wrote: > On Wed, 19 May 2010 03:53:44 -0700, Javier Montoya wrote: > > Dear all, > > > I've a list of float numbers and I would like to delete incrementally a > > set of elements in a given range of indexes, sth. like: > > > for j in range(beginIndex, endIndex+1

Re: help need to write a python spell checker

2010-05-19 Thread Terry Reedy
On 5/19/2010 3:17 AM, CM wrote: I love how he just copied and pasted the assignment without any other remarks. Yeah, that way he did not mess it up ;-). -- http://mail.python.org/mailman/listinfo/python-list

Re: __str__ for each function in a class

2010-05-19 Thread Xavier Ho
On 5/19/2010 1:14 AM, Vincent Davis wrote: > class C(object): >> def __init__(self, new): >> self.letter = dict(a=1,b=2,c=3, amin=np.amin) >> self.new = new >> self._x = None >> self._Y = None >> >> @property >> def x(self): >> """I'm the 'x' property.""

Re: __str__ for each function in a class

2010-05-19 Thread Terry Reedy
On 5/19/2010 1:14 AM, Vincent Davis wrote: I am sure this is easy but I am not sure how to do it and google was failing me. Lets say I have a class() with an def x() and def y() and I want print(class.x) and (class.y) to have custom prints (__str__) how do I do this For example class C(object):

Delete files from FTP Server older then 7 days. Using ftputil and ftplib.

2010-05-19 Thread pilgrim773
Hello I am new to Python programming. I need a write a script which will delete files from a FTP server after they have reached a certain age, like 7 days for example. I have prepared this code below, but I get an error message: The system cannot find the path specified: '/test123/*.*' Probably som

Re: Global variables for python applications

2010-05-19 Thread Steven D'Aprano
On Wed, 19 May 2010 00:16:56 -0700, TomF wrote: > Let's say you have a bunch of globals, one of which is a verbose flag. > If I understand the difference, using a module gbls.py: > > # in gbls.py > verbose = False > # elsewhere: > import gbls > gbls.verbose = True > > Using a class: > > # In th

Python Script for Website Mirroring

2010-05-19 Thread Kevin Rea
Hello Folks: Can you please point me to a decent Python script(s) that I could customize to do automatic Website mirroring? Thanks Much! Kevin -- http://mail.python.org/mailman/listinfo/python-list

View Html/ py code in a zip as HTML/text ? ( for phone )

2010-05-19 Thread Jake b
I'm trying to figure out the best way to view python snippets / smaller files on the itouch/iPhone. I'm reading a new projects docs, but it's not easy to view the zip. It can't view zip files. Say I want to read pyglet examples, I need unzip at least one file and serve that. If it is text/HTML/py

Re: remove elements incrementally from a list

2010-05-19 Thread Steven D'Aprano
On Wed, 19 May 2010 03:53:44 -0700, Javier Montoya wrote: > Dear all, > > I've a list of float numbers and I would like to delete incrementally a > set of elements in a given range of indexes, sth. like: > > for j in range(beginIndex, endIndex+1): >print ("remove [%d] => val: %g" % (j, myLis

Re: Reading data from a Microsoft Access 2003 database

2010-05-19 Thread Les Schaffer
Adam Tauno Williams wrote: The OP: "I use Ubuntu 64 bit" woops, my bad ... -- http://mail.python.org/mailman/listinfo/python-list

Re: remove elements incrementally from a list

2010-05-19 Thread Steven W. Orr
On 5/19/2010 6:53 AM, Javier Montoya wrote: I've a list of float numbers and I would like to delete incrementally a set of elements in a given range of indexes, sth. like: for j in range(beginIndex, endIndex+1): print ("remove [%d] => val: %g" % (j, myList[j])) del myList[j] However,

Re: abc don't play well with private method

2010-05-19 Thread mouadino
Hello, and thank you for ALL the informations. i think i was reading the wrong documents :) For my use of ABC, i wanted to implement a plugin interface with the ABC, in first i define a Base class (ABC) that other class inherit(implement) so that they can be interfaced as plugins. but i did have

Re: Reading data from a Microsoft Access 2003 database

2010-05-19 Thread Adam Tauno Williams
On Wed, 2010-05-19 at 02:28 -0700, Jimoid wrote: > Hi All, > I use Ubuntu 64 bit and need to develop a programme (ideally in > Python) to work on data that is contained in a Microsoft Access 2003 > database. I do not need to modify the database, simply read a few > columns of data from some tables.

Re: Reading data from a Microsoft Access 2003 database

2010-05-19 Thread Adam Tauno Williams
On Wed, 2010-05-19 at 08:05 -0400, Les Schaffer wrote: > Jimoid wrote: > > > I use Ubuntu 64 bit and need to develop a programme (ideally in > > Python) to work on data that is contained in a Microsoft Access 2003 > > database. I do not need to modify the database, simply read a few > > columns of

Re: Reading data from a Microsoft Access 2003 database

2010-05-19 Thread Les Schaffer
Jimoid wrote: I use Ubuntu 64 bit and need to develop a programme (ideally in Python) to work on data that is contained in a Microsoft Access 2003 database. I do not need to modify the database, simply read a few columns of data from some tables. this worked like a charm for me: http://code.a

RE: Reading data from a Microsoft Access 2003 database

2010-05-19 Thread Ahmed, Shakir
-Original Message- From: python-list-bounces+shahmed=sfwmd@python.org [mailto:python-list-bounces+shahmed=sfwmd@python.org] On Behalf Of Simon Brunning Sent: Wednesday, May 19, 2010 6:13 AM To: python-list Subject: Re: Reading data from a Microsoft Access 2003 database On 19 May 2

Re: remove elements incrementally from a list

2010-05-19 Thread Mark Lawrence
On 19/05/2010 11:53, Javier Montoya wrote: Dear all, I've a list of float numbers and I would like to delete incrementally a set of elements in a given range of indexes, sth. like: for j in range(beginIndex, endIndex+1): print ("remove [%d] => val: %g" % (j, myList[j])) del myList[j]

multiprocessing module - could it use google protocol buffers?

2010-05-19 Thread zLuke
Does it make sense to be able to substitute the pickling action in the multiprocessing module with google protocol buffers instead? If so, has anyone thought how to do it? I wanted some operation more compact/ faster than pickling for ipc of data. Also, has anyone built any wrappers for the mult

Re: remove elements incrementally from a list

2010-05-19 Thread superpollo
Javier Montoya ha scritto: Dear all, I've a list of float numbers and I would like to delete incrementally a set of elements in a given range of indexes, sth. like: for j in range(beginIndex, endIndex+1): print ("remove [%d] => val: %g" % (j, myList[j])) del myList[j] However, since I'm

remove elements incrementally from a list

2010-05-19 Thread Javier Montoya
Dear all, I've a list of float numbers and I would like to delete incrementally a set of elements in a given range of indexes, sth. like: for j in range(beginIndex, endIndex+1): print ("remove [%d] => val: %g" % (j, myList[j])) del myList[j] However, since I'm iterating over the same list,

Re: Reading data from a Microsoft Access 2003 database

2010-05-19 Thread Simon Brunning
On 19 May 2010 10:28:15 UTC+1, Jimoid wrote: > I use Ubuntu 64 bit and need to develop a programme (ideally in > Python) to work on data that is contained in a Microsoft Access 2003 > database. I do not need to modify the database, simply read a few > columns of data from some tables. mxODBC migh

Re: Classes and threading

2010-05-19 Thread Christian Heimes
Or if you do need to override it for some reason, you need to accept the extra args and pass them on: class nThread(threading.Thread): def __init__(self, *args, **kwds): threading.Thread.__init__(self, *args, **kwds) # your other stuff here Since Thread is a

Reading data from a Microsoft Access 2003 database

2010-05-19 Thread Jimoid
Hi All, I use Ubuntu 64 bit and need to develop a programme (ideally in Python) to work on data that is contained in a Microsoft Access 2003 database. I do not need to modify the database, simply read a few columns of data from some tables. Google hasn't been able to offer me a suitable solution

Re: Classes and threading

2010-05-19 Thread Adam W.
On May 19, 4:30 am, Gregory Ewing wrote: > Or if you do need to override it for some reason, you > need to accept the extra args and pass them on: > >    class nThread(threading.Thread): > >        def __init__(self, *args, **kwds): >            threading.Thread.__init__(self, *args, **kwds) >    

Re: Classes and threading

2010-05-19 Thread Gregory Ewing
Erik Max Francis wrote: Adam W. wrote: class nThread(threading.Thread): def __init__(self): threading.Thread.__init__(self) If you don't intend to override the constructor in the parent class, simply don't define it. Or if you do need to override it for some reason, you need to

  1   2   >