Re: struct.Struct random access

2008-08-28 Thread Tim Roberts
castironpi <[EMAIL PROTECTED]> wrote: > >I'd like to seriously nominate this idea and get a considered opinion >on it. > >struct.Struct lets you encode Python objects into structured memory. >It accepts a format string, and optionally a buffer and offset to/from >which to read/write the structure.

Re: Ctypes module - looking for a way to dynamically call exported function from a set of dlls

2008-08-28 Thread dudeja . rajat
On Wed, Aug 27, 2008 at 5:20 AM, Gabriel Genellina <[EMAIL PROTECTED]> wrote: > En Tue, 26 Aug 2008 07:42:50 -0300, <[EMAIL PROTECTED]> escribi�: > >> Hi, >> >> I'm using the ctypes module to load my dlls. >> >> I have some 10 dlls the names of those are passed to a fucntion which >> then loads the

Re: Tkinter event loop question

2008-08-28 Thread gordon
On Aug 27, 10:42 pm, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > so I guess the question here is from where you expect to call that > method, and what you expect Tkinter to do when you call it... thanks for the reply i was planning to write a controller (as in MVC) that will instantiate a gui clas

I/O error 13 Permission denied -Cannot access file as it is used by another process.

2008-08-28 Thread aditya shukla
Hello folks, I am creating a python script[windows vista and python2.5] which accesses another program(prog2).I my python script i am creating a temporary file and i write the output of prog2 in this temporary file. temp = tempfile.NamedTemporaryFile(suffix='_suffix',prefix='prefix_',dir='C:\\Pyt

Re: How to ignore the first line of the text read from a file

2008-08-28 Thread Chris
On Aug 28, 6:11 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Hello, > > I am new to Python and have one simple question to which I cannot find > a satisfactory solution. > I want to read text line-by-line from a text file, but want to ignore > only the first line. I know how to do it in Jav

Re: How to ignore the first line of the text read from a file

2008-08-28 Thread Santiago Romero
> I want to read text line-by-line from a text file, but want to ignore > only the first line. I know how to do it in Java (Java has been my > primary language for the last couple of years) and following is what I > have in Python, but I don't like it and want to learn the better way > of doing it.

Re: calling NetShareEnum win32api with ctypes

2008-08-28 Thread Tim Golden
taghi wrote: I want to call NetShareEnum, a function from netapi32.dll Not a straightforward answer but... are you aware that this particular call is already wrapped by the pywin32 packages: https://sourceforge.net/projects/pywin32/ http://timgolden.me.uk/pywin32-docs/win32net__NetShareEnum_m

Re: I/O error 13 Permission denied -Cannot access file as it is used by another process.

2008-08-28 Thread Tim Golden
aditya shukla wrote: Hello folks, I am creating a python script[windows vista and python2.5] which accesses another program(prog2).I my python script i am creating a temporary file and i write the output of prog2 in this temporary file. temp = tempfile.NamedTemporaryFile(suffix='_suffix',pr

Re: calling NetShareEnum win32api with ctypes

2008-08-28 Thread Tim Golden
taghi wrote: I wrote this code in python 2.5: from ctypes import * ... snip ... netapi32=cdll.LoadLibrary('netapi32.dll') This is your problem: netapi32 is a windows DLL and needs to be attached as such: netapi32 = windll.LoadLibrary ("netapi32.dll") or, more simply: netapi32 = win

Re: calling NetShareEnum win32api with ctypes

2008-08-28 Thread Tim Golden
taghi wrote: I wrote this code in python 2.5: from ctypes import * ... snip ... netapi32=cdll.LoadLibrary('netapi32.dll') This is your problem: netapi32 is a windows DLL and needs to be attached as such: netapi32 = windll.LoadLibrary ("netapi32.dll") or, more simply: netapi32 = win

Re: problem with packages and path

2008-08-28 Thread Marco Bizzarri
On Wed, Aug 27, 2008 at 6:44 PM, Daniel <[EMAIL PROTECTED]> wrote: > Hello, > > I'm writing some unit tests for my python software which uses > packages. Here is the basic structure: > > mypackage > __init__.py > module1 >__init__.py >mod1.py > module2 >__init__.py >mod2.py > u

Re: calling NetShareEnum win32api with ctypes

2008-08-28 Thread Gabriel Genellina
En Thu, 28 Aug 2008 02:01:23 -0300, taghi <[EMAIL PROTECTED]> escribi�: I want to call NetShareEnum, a function from netapi32.dll NetShareEnum has this definition: [...] netapi32=cdll.LoadLibrary('netapi32.dll') netapi32.NetShareEnum(cname, level, byref(bufptr), prefmaxlen, byref(entriesread), b

Re: Syntax error in ".py" file and globals variable values not available.

2008-08-28 Thread Alexis Boutillier
Timothy Grant a écrit : On Wed, Aug 27, 2008 at 2:49 AM, Alexis Boutillier <[EMAIL PROTECTED]> wrote: Hi, I have a strange behaviour of python with pdb and import statement. Here is the example code : file my1.py: import my2 file my2.py: a=5 toto I intentionnaly put a syntax error in file my

Descriptor leak in python 2.4 subprocess module

2008-08-28 Thread Michel Lespinasse
Hi, I hit an issue with the following python code: try: get_orient = subprocess.Popen (['jpegexiforient', '-n', pathfull], stdin = subprocess.PIPE, stdout = subprocess.PIPE) orient = get_orient.commu

Re: Descriptor leak in python 2.4 subprocess module

2008-08-28 Thread Tim Golden
Michel Lespinasse wrote: Hi, I hit an issue with the following python code: try: get_orient = subprocess.Popen (['jpegexiforient', '-n', pathfull], stdin = subprocess.PIPE, stdout = subprocess.PIPE)

Re: Pythoncom and pywintypes

2008-08-28 Thread Gabriel Genellina
En Wed, 27 Aug 2008 21:17:22 -0300, Vistro <[EMAIL PROTECTED]> escribi�: Hey, there. I've been coding in python for about three weeks now. I have made basic games, tools to check forum PMs for me, and other general utilities with python, but I'm now encountering problems. http://ubuntuforums.or

Re: [Q] How to ignore the first line of the text read from a file

2008-08-28 Thread Ken Starks
[EMAIL PROTECTED] wrote: Hello, I am new to Python and have one simple question to which I cannot find a satisfactory solution. I want to read text line-by-line from a text file, but want to ignore only the first line. I know how to do it in Java (Java has been my primary language for the last c

PYTHONPATH and modules

2008-08-28 Thread Juan
Hi I am programming a little script that makes use of a module I developed before. The utils are inside the directory src of the directory utils, and the package is nutum.utils. The script is in the directory src inside the directory sysinfo, and the package is nutum.sysinfo. Well, if not clear, t

Re: [Q] How to ignore the first line of the text read from a file

2008-08-28 Thread Paul Rubin
Ken Starks <[EMAIL PROTECTED]> writes: > LineList=open(filename,'r').readlines()[1,] You don't want to do that if the file is very large. Also, you meant [1:] rather than [1,] -- http://mail.python.org/mailman/listinfo/python-list

Re: How to ignore the first line of the text read from a file

2008-08-28 Thread Chris
On Aug 28, 11:53 am, Ken Starks <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > Hello, > > > I am new to Python and have one simple question to which I cannot find > > a satisfactory solution. > > I want to read text line-by-line from a text file, but want to ignore > > only the first lin

filter in for loop

2008-08-28 Thread GHZ
I would like to say something like: for x in l if : e.g. for filename in os.listdir(DIR) if filename[-4:] == '.xml': instead of having to say: for filename in os.listdir(DIR): if filename[-4:] == '.xml': or for filename in (f for f in os.listdir(DIR) if f[-4] == '.xml

Re: filter in for loop

2008-08-28 Thread Bruno Desthuilliers
GHZ a écrit : I would like to say something like: for x in l if : e.g. for filename in os.listdir(DIR) if filename[-4:] == '.xml': instead of having to say: for filename in os.listdir(DIR): if filename[-4:] == '.xml': or for filename in (f for f in os.listdir(DIR) i

Re: filter in for loop

2008-08-28 Thread Chris
On Aug 28, 12:20 pm, GHZ <[EMAIL PROTECTED]> wrote: > I would like to say something like: > > for x in l if : >     > > e.g. > > for filename in os.listdir(DIR) if filename[-4:] == '.xml': >     > > instead of having to say: > > for filename in os.listdir(DIR): >     if filename[-4:] == '.xml': >

Re: filter in for loop

2008-08-28 Thread Timo
On 28 elo, 13:20, GHZ <[EMAIL PROTECTED]> wrote: > > is there a shortcut I'm missing? (Adding to Bruno's comment) This kind of style provides a reusable filter/generator-function and as a bonus, the for-loop becomes easier to understand. from os.path import abspath from glob import iglob def i

Re: Python sockets UDP broadcast multicast question??

2008-08-28 Thread Francesco Bochicchio
On 28 Ago, 08:09, inorlando <[EMAIL PROTECTED]> wrote: > Hi all, > > I have a question about python and sockets , UDP datagram in > particular. I'm new to socket programming so please bare with me. > > I am trying to write a simple application that broadcast files to > another computer on the same

Re: Function References

2008-08-28 Thread Lie
On Aug 1, 6:35 am, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] schrieb: > > > On Jul 31, 10:47 am, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > >> I take the freedom to do so as I see fit - this is usenet... > > > Fine, then keep beating a dead horse by replying to this thr

Re: Function References

2008-08-28 Thread Diez B. Roggisch
> Zen's lesson for today: > THOU SHALT NOT MESS WITH ANY PYTHON'S SEMI-GODS, DEMI-GODS, AND > PYTHON'S GOD. > > You're lucky Diez still want to help you with your attitude like that. > May I remind you that we here helps you for free in our free time, be > rude, especially to a frequent member, an

Tkinter tkMessageBox problem - message box is displayed with an additional window

2008-08-28 Thread dudeja . rajat
Hi, I'm working on Windows Platform I'm facing some problem with the tkMessageBox. My code is as below: import tkMessageBox import Tix from Tkinter import * if len(installedLibPath) != len(listOfLibraries): if tkMessageBox.askyesno("Question", \ type='yes

Re: PYTHONPATH and modules

2008-08-28 Thread Bruno Desthuilliers
Juan a écrit : Hi I am programming a little script that makes use of a module I developed before. The utils are inside the directory src of the directory utils, and the package is nutum.utils. The script is in the directory src inside the directory sysinfo, and the package is nutum.sysinfo. Wo

ANN: Leo 4.5 rc1 released

2008-08-28 Thread Edward K Ream
Leo 4.5 rc1 is now available at: http://sourceforge.net/project/showfiles.php?group_id=3458&package_id=29106 Leo 4.5 contains many important new features. See below for details. Leo is a text editor, data organizer, project manager and much more. See: http://webpages.charter.net/edreamleo/intro.

Re: How to ignore the first line of the text read from a file

2008-08-28 Thread rurpy
On Aug 27, 11:12 pm, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > On Wed, 27 Aug 2008 21:11:26 -0700, [EMAIL PROTECTED] wrote: > > I want to read text line-by-line from a text file, but want to ignore > > only the first line. I know how to do it in Java (Java has been my > > primary langua

Re: GUI programming with python

2008-08-28 Thread Bruno Desthuilliers
zamil a écrit : Hello Everyone It's my very first email to this group. i am a beginner programmer of python. it it possible to build Desktop application using python. Yes. Which IDE should i use for this purpose? I suspect you are confusing "IDE" with "GUI builder". FWIW, you don't *need*

Re: How to ignore the first line of the text read from a file

2008-08-28 Thread Paul Rubin
[EMAIL PROTECTED] writes: > If the OP needs line numbers elsewhere in the > code something like the following would work. > > infile = open(fileName, 'r') > for lineNumber, line in enumerate (infile): > # enumerate returns numbers starting with 0. > if lineNumber == 0: continue > print

Re: Process "Killed"

2008-08-28 Thread Matt Nordhoff
dieter wrote: > Hi, > > Overview > === > > I'm doing some simple file manipulation work and the process gets > "Killed" everytime I run it. No traceback, no segfault... just the > word "Killed" in the bash shell and the process ends. The first few > batch runs would only succeed with one or t

Re: python on Mac

2008-08-28 Thread Lou Pecora
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] wrote: > Hi All. > I'm really new in the python world, so, sorry if my question is particulary > stupid. > I've just installed on my system (Mac OS X 10.4 PPC) the python version > 2.5.2 and all works fine. > My next step is to install the version

PyImport_ImportModule deadlocks

2008-08-28 Thread [EMAIL PROTECTED]
Hey all, I have an embedded Python shell and everything works fine, however, in my stdout catcher (in C to grab tracebacks) for some reason when I do a : PyImport_ImportModule( "sys" ) It deadlocks the process, is there a need for me to acquire locks inside of my stdout catching function before

Re: Multiple values for one key

2008-08-28 Thread Maric Michaud
Le Thursday 28 August 2008 03:43:16 norseman, vous avez écrit : > Terry Reedy wrote: > > Ron Brennan wrote: > >> Hello, > >> > >> > >> How would I create a dictionary that contains multiple values for one > >> key. > > > > Make the value a collection object (set or list if you plan to add and > > d

Re: List of modules available for import inside Python?

2008-08-28 Thread pruebauno
On Aug 28, 12:21 am, ssecorp <[EMAIL PROTECTED]> wrote: > Is there a way to view all the modules I have available for import > from within Python? > Like writing in the interpreter: > import.modules > > Also, is there anything like Cpan for Python? Isn't the most obvious answer to the first questi

Re: Tkinter tkMessageBox problem - message box is displayed with an additional window

2008-08-28 Thread Guilherme Polo
On Thu, Aug 28, 2008 at 10:29 AM, <[EMAIL PROTECTED]> wrote: > Hi, > I'm working on Windows Platform > > I'm facing some problem with the tkMessageBox. My code is as below: > > import tkMessageBox > import Tix > from Tkinter import * > > if len(installedLibPath) != len(listOfLibraries): >i

Re: filter in for loop

2008-08-28 Thread Jerry Hill
On Thu, Aug 28, 2008 at 6:20 AM, GHZ <[EMAIL PROTECTED]> wrote: > is there a shortcut I'm missing? Well, there's another way to do it, using the filter built in function: for filename in filter(lambda f:f.endswith('.xml'), os.listdir('.')): print filename You can do the same thing with i

Python svn bindings for Subversion?

2008-08-28 Thread Mike B
I'm trying to get Subversion 'hook scripts' working on an Ubuntu box and the following fails. from svn import fs, repos, core, delta As far as I can tell there are two Python Subversion libraries, 'pysvn' and 'svn': 'pysvn' from http://pysvn.tigris.org/ appears to be a client side interface and i

cannot find object instance

2008-08-28 Thread jimgardener
hi, i am a python newbie..while trying out some message passing between two object instances i came across a problem moduleA.py import moduleB class MyClassA: def __init__(self): self.age=0 self.address='' def createClassB(self): self.objB=module

Re: Identifying the start of good data in a list

2008-08-28 Thread Gerard flanagan
George Sakkis wrote: On Aug 27, 3:00 pm, Gerard flanagan <[EMAIL PROTECTED]> wrote: [EMAIL PROTECTED] wrote: I have a list that starts with zeros, has sporadic data, and then has good data. I define the point at which the data turns good to be the first index with a non-zero entry that is fol

Re: Multiple values for one key

2008-08-28 Thread Bruno Desthuilliers
norseman a écrit : Terry Reedy wrote: Ron Brennan wrote: Hello, How would I create a dictionary that contains multiple values for one key. Make the value a collection object (set or list if you plan to add and delete). I'd also like the key to be able to have duplicate entries.

Re: def X(l=[]): weirdness. Python bug ?

2008-08-28 Thread Andrew Lee
Bart van Deenen wrote: Hi all. I've stumbled onto a python behavior that I don't understand at all. Python 2.5.2 (r252:60911, Jul 31 2008, 17:28:52) # function def X(l=[]): l.append(1) print l # first call of X X() [1] #second call of X X() [1, 1] Where does the list parameter 'l'

Re: Wild Card String Comparison

2008-08-28 Thread Cameron Laird
In article <[EMAIL PROTECTED]>, W. eWatson <[EMAIL PROTECTED]> wrote: >Is it possible to do a search for a wild card string in another string. For >example, I'd like to find "v*.dat" in a string called bingo. v must be >matched against only the first character in bingo, and not simply found >som

Re: List of modules available for import inside Python?

2008-08-28 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: Is there a way to view all the modules I have available for import from within Python? Like writing in the interpreter: import.modules Also, is there anything like Cpan for Python? Isn't the most obvious answer to the first question this link? depends on whether you

Problem with list.insert

2008-08-28 Thread SUBHABRATA
Dear Group, I wrote one program, There is a dictionary. There is an input string. Every word of input string the word is matched against the dictionary If the word of input string is matched against the dictionary it gives the word of the dictionary. But if it does not find it gives the original wo

Re: cannot find object instance

2008-08-28 Thread Bruno Desthuilliers
jimgardener a écrit : hi, i am a python newbie.. From what I can see from your code, you're a newbie to programming in general... while trying out some message passing between two object instances i came across a problem First point : you have both a circular dependency between ModuleA an

Re: Problem with list.insert

2008-08-28 Thread Marc 'BlackJack' Rintsch
On Thu, 28 Aug 2008 09:13:00 -0700, SUBHABRATA wrote: > import re > def wordchecker1(n): > # INPUTTING STRING > a1=raw_input("PRINT ONE ENGLISH SENTENCE FOR DICTIONARY CHECK:") > #CONVERTING TO LOWER CASE > a2=a1.lower() > #CONVERTING INTO LIST > a3=a2.split() > #DICTIO

Re: cannot find object instance

2008-08-28 Thread Marc 'BlackJack' Rintsch
On Thu, 28 Aug 2008 08:35:07 -0700, jimgardener wrote: > moduleA.py > > import moduleB > > […] > > moduleB.py > -- > import moduleA > > […] Don't do that. Circular imports are a code smell. If two modules are coupled that tight it's usually a sign that yo

Re: Multiple values for one key

2008-08-28 Thread Tim Rowe
2008/8/28 Bruno Desthuilliers <[EMAIL PROTECTED]>: > You can either use 1/ a list of dicts, or 2/ a dict mapping keys to lists. > > 1/ > records = [ > {"name":"guy", "address":"unknown","zip":"0"}, > {"name":"girl", "address":"123 tiny street","zip":"12345"}, > {"name":"boy", "address":"

Re: How to update value in dictionary?

2008-08-28 Thread MRAB
On Aug 27, 8:01 pm, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > mblume wrote: > >> 2) setdefault is your friend > > >> d = {} > >> d['a'] = d.setdefault('a', 1) + 1 > > > d['a'] = d.get('a', 1) + 1 > > > seems to me a little better, as d['a'] doesn't get set twice, right? > > setdefault is pronounce

Re: Multiple values for one key

2008-08-28 Thread Ron Brennan
I have another question. How would like to be able to add the contents on the values for one key. key['20001']:[978, 345] How can I do this? Thanks, Ron On Thu, Aug 28, 2008 at 11:56 AM, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > norseman a écrit : > >> Terry Reedy wrote: >> >>> >>> >>

Re: cannot find object instance

2008-08-28 Thread jimgardener
On Aug 28, 9:35 pm, Bruno Desthuilliers wrote: Such a ping-pong between two classes is more often > than not a design smell. thanks Bruno,i understand my mistake..should have figured it out myself thanks again jim -- http://mail.python.org/mailman/listinfo/python-list

Re: Problem with list.insert

2008-08-28 Thread SUBHABRATA
Some people in the room told I am kidding, but I learnt Python from Python docs which gives examples like these, But I write explicit comments, an excerpt from python docs: # Measure some strings: ... a = ['cat', 'window', 'defenestrate'] >>> for x in a: ... print x, len(x) ... cat 3 window 6 d

Re: [Q] How to ignore the first line of the text read from a file

2008-08-28 Thread norseman
Benjamin Kaplan wrote: On Thu, Aug 28, 2008 at 12:11 AM, [EMAIL PROTECTED] < [EMAIL PROTECTED]> wrote: Hello, I am new to Python and have one simple question to which I cannot find a satisfactory solution. I want to read text line-by-line from a text file, but want to ignore only the first lin

epoch seconds from a datetime

2008-08-28 Thread Richard Rossel
Hi friends, I need a little help here, I 'm stuck with epoch calculation issue. I have this datetime: date_new = datetime(*time.strptime('20080101T00','%Y%m%dT%H%M%S') [0:6]) This date_new is in UTC Now I need to know the seconds since epoch of this new date, so I run this: seconds = int(time.m

Re: Problem with list.insert

2008-08-28 Thread Diez B. Roggisch
SUBHABRATA schrieb: Some people in the room told I am kidding, but I learnt Python from Python docs which gives examples like these, But I write explicit comments, an excerpt from python docs: # Measure some strings: ... a = ['cat', 'window', 'defenestrate'] for x in a: ... print x, len(x)

Re: Problem with list.insert

2008-08-28 Thread Diez B. Roggisch
Diez B. Roggisch schrieb: SUBHABRATA schrieb: Some people in the room told I am kidding, but I learnt Python from Python docs which gives examples like these, But I write explicit comments, an excerpt from python docs: # Measure some strings: ... a = ['cat', 'window', 'defenestrate'] for x in a

Re: Python svn bindings for Subversion?

2008-08-28 Thread Benjamin Kaplan
On Thu, Aug 28, 2008 at 11:22 AM, Mike B <[EMAIL PROTECTED]> wrote: > I'm trying to get Subversion 'hook scripts' working on an Ubuntu box and > the > following fails. > > from svn import fs, repos, core, delta > > As far as I can tell there are two Python Subversion libraries, 'pysvn' and > 'svn'

Re: Problem with list.insert

2008-08-28 Thread bearophileHUGS
Subhabrata, it's very difficult for me to understand what your short program has to do, or what you say. I think that formatting and code style are important. So I suggest you to give meaningful names to all your variable names, to remove unused variables (like n), to add blank likes here and ther

Re: List of modules available for import inside Python?

2008-08-28 Thread Jason Scheirer
On Aug 27, 11:04 pm, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > ssecorp wrote: > > Is there a way to view all the modules I have available for import > > from within Python? > > Like writing in the interpreter: > > import.modules > > there's a helper script in the 2.5 source code kit that locates a

Re: epoch seconds from a datetime

2008-08-28 Thread Chris Rebert
On Thu, Aug 28, 2008 at 10:18 AM, Richard Rossel <[EMAIL PROTECTED]> wrote: > Hi friends, > I need a little help here, I 'm stuck with epoch calculation issue. > I have this datetime: > date_new = datetime(*time.strptime('20080101T00','%Y%m%dT%H%M%S') > [0:6]) > This date_new is in UTC > Now I

Re: no string.downer() ?

2008-08-28 Thread Tobiah
> Never ascribe to humour that which can be adequately explained by > increadible stupidity! I love the irony. Don't feel bad. I recently corrected someone's 'grammer' with a similar tone. ** Posted from http://www.teranews.com ** -- http://mail.python.org/mailman/listinfo/python-list

Re: Identifying the start of good data in a list

2008-08-28 Thread castironpi
On Aug 27, 3:42 pm, George Sakkis <[EMAIL PROTECTED]> wrote: > Below are two more versions that pass all the doctests: the first > works only for lists and modifies them in place and the second works > for arbitrary iterables: > > def clean_inplace(seq, good_ones=4): >     start = 0 >     n = len(s

Re: epoch seconds from a datetime

2008-08-28 Thread Richard Rossel
On 28 ago, 14:25, "Chris Rebert" <[EMAIL PROTECTED]> wrote: > On Thu, Aug 28, 2008 at 10:18 AM, Richard Rossel <[EMAIL PROTECTED]> wrote: > > Hi friends, > > I need a little help here, I 'm stuck with epoch calculation issue. > > I have this datetime: > > date_new = datetime(*time.strptime('2008010

Re: no string.downer() ?

2008-08-28 Thread Fredrik Lundh
Tobiah wrote: Never ascribe to humour that which can be adequately explained by increadible stupidity! I love the irony. Muphry's law. -- http://mail.python.org/mailman/listinfo/python-list

Re: Python multimap

2008-08-28 Thread brad
Carl Banks wrote: Out of curiosity, what does a true multimap solve that a dictionary of lists not solve? Nothing really. I went with a variation of the suggested work around... it's just that with Python I don't normally have to use work arounds and normally one obvious approach is correct:

Re: Multiple values for one key

2008-08-28 Thread Chris Rebert
On Thu, Aug 28, 2008 at 10:02 AM, Ron Brennan <[EMAIL PROTECTED]> wrote: > I have another question. > > How would like to be able to add the contents on the values for one key. > > key['20001']:[978, 345] I'm assuming that by this you meant: assert the_dict['20001'] == [978, 345] > > How can I do

Re: struct.Struct random access

2008-08-28 Thread castironpi
On Aug 28, 1:59 am, Tim Roberts <[EMAIL PROTECTED]> wrote: > castironpi <[EMAIL PROTECTED]> wrote: > > >I'd like to seriously nominate this idea and get a considered opinion > >on it. > > >struct.Struct lets you encode Python objects into structured memory. > >It accepts a format string, and option

Re: Pythoncom and pywintypes

2008-08-28 Thread Vistro
A Reinstall seems to have done nothing... On Thu, Aug 28, 2008 at 4:49 AM, Gabriel Genellina <[EMAIL PROTECTED]>wrote: > En Wed, 27 Aug 2008 21:17:22 -0300, Vistro <[EMAIL PROTECTED]> escribi�: > > Hey, there. I've been coding in python for about three weeks now. I have >> made basic games, tool

Re: Problem with list.insert

2008-08-28 Thread castironpi
On Aug 28, 11:13 am, SUBHABRATA <[EMAIL PROTECTED]> wrote: > Dear Group, > I wrote one program, > There is a dictionary. > There is an input string. > Every word of input string the word is matched against the dictionary > If the word of input string is matched against the dictionary it gives > the

Sending e-mail

2008-08-28 Thread peter . jones . rpi
I work at a training center and I would like to use Python to generate a number of certificates and then e-mail them. The certificates are a problem for another day - right now I just want to figure out how to send an e-mail. I confess I don't know much about the protocol(s) for e-mail. In PHP usi

Re: Sending e-mail

2008-08-28 Thread Waldemar Osuch
On Aug 28, 12:52 pm, [EMAIL PROTECTED] wrote: > I work at a training center and I would like to use Python to generate > a number of certificates and then e-mail them. The certificates are a > problem for another day - right now I just want to figure out how to > send an e-mail. > > I confess I don

Re: Sending e-mail

2008-08-28 Thread Vistro
I used that code before, and it did not do what it needed to do. If you are just sending text, this usually works for me. def sendMail(): ## Parameters for SMTP session port=587 SMTPserver= 'smtp.gmail.com' SMTPuser= 'gmail username, which is your gmail address' pw= 'your gma

ImageTk.Photoimage not displayed

2008-08-28 Thread harryos
hi i am trying to display an image on a canvas in a gui made with Tkinter widgets class PhotoDisplay: def __init__(self,parent): self.mainframe = Frame(parent,background="grey") . #added a subframe to hold canvas and button self.canvFrame=Frame(

file data to list

2008-08-28 Thread Anish Chapagain
Hi!! I am facing problem for extracting file data to the list so as to have graph plotted through list. my file(eg: data.txt) is having data like this, cnt0001a 29000 xretya 01 cnt0002a 29850 brishal 02 cnt0003a 31250 kristal 03 from here, I need to copy data 29000, 29850, 31250 into a single lis

Wholesale Air Jordan Six Rings (6 IX Rings) sneakers (www.sneakers-in-china.com)

2008-08-28 Thread www.sneakers-in-china.com
(ww w.sneakers-in-china.com)air max 87 89 90 95 ltd timberland jeans ugg boots lacoste sandals hoodies,t-shirts,mauri shoes,dsquared,hogan shoes,dunks,red monkey,polo t-shirts, evisu jeans, bbc jeans,dior,lv,dg,versace,coach puma shoes,nfl jerseys shox r2 r3 r4 r5 r6 tn tl1 tl3, sandals, nhl jersey

Re: ImageTk.Photoimage not displayed

2008-08-28 Thread Guilherme Polo
On Thu, Aug 28, 2008 at 4:07 PM, harryos <[EMAIL PROTECTED]> wrote: > hi > i am trying to display an image on a canvas in a gui made with Tkinter > widgets > > > class PhotoDisplay: >def __init__(self,parent): >self.mainframe = Frame(parent,background="grey") >. >#ad

Re: file data to list

2008-08-28 Thread bearophileHUGS
Anish Chapagain: > cnt0001a 29000 xretya 01 > cnt0002a 29850 brishal 02 > cnt0003a 31250 kristal 03 > from here, I need to copy data 29000, 29850, 31250 into a single list > and > 01, 02, 03 to another so as to plot graph using these value. This may offer you a starting point: >>> line = "cnt0003

re.compile versus r''

2008-08-28 Thread Terrence Brannon
Hello, I'm using a tool (PLY) which apparently expects the tokens to be created using r'' But because one token is a rather complex regular expression, I want to create the regular expression programmatically. How can I generate a string and then create something of the same type that the r'' fun

Re: Sending e-mail

2008-08-28 Thread gordyt
Peter here is an example. I just tried it and it works fine. from smtplib import SMTP HOST = "smtp.gmail.com" PORT = 587 ACCOUNT = "" # put your gmail email account name here PASSWORD = "" # put your gmail email account password here def send_email(to_addrs, subject, msg): server = SMTP(HO

[MacOS X] plat-mac/errors.rsrc.df.rsrc not installed/created

2008-08-28 Thread Christian Ebert
Hi, I am on MacOS 10.4.11, and have a minor recurring problem, when using my own Python installation. I only stumbled over it when using http operations with the Mercurial SCM, and my /tmp/ folder was clobbered with *.rsrc temporary files. Some references: http://www.selenic.com/pipermail/mercur

Re: file data to list

2008-08-28 Thread Marc 'BlackJack' Rintsch
On Thu, 28 Aug 2008 12:11:39 -0700, Anish Chapagain wrote: > I am facing problem for extracting file data to the list so as to have > graph plotted through list. > my file(eg: data.txt) is having data like this, > > cnt0001a 29000 xretya 01 > cnt0002a 29850 brishal 02 > cnt0003a 31250 kristal 03

Re: re.compile versus r''

2008-08-28 Thread Terrence Brannon
Oh my god, how embarrassing. the r'' notation is to create raw string I thought it was some form of blessing a string into a regular expression class. -- http://mail.python.org/mailman/listinfo/python-list

Re: Python multimap

2008-08-28 Thread Carl Banks
On Aug 28, 2:41 pm, brad <[EMAIL PROTECTED]> wrote: > Carl Banks wrote: > > Out of curiosity, what does a true multimap solve that a dictionary of > > lists not solve? > > Nothing really. I went with a variation of the suggested work around... > it's just that with Python I don't normally have to u

Re: re.compile versus r''

2008-08-28 Thread Fredrik Lundh
Terrence Brannon wrote: Hello, I'm using a tool (PLY) which apparently expects the tokens to be created using r'' But because one token is a rather complex regular expression, I want to create the regular expression programmatically. How can I generate a string and then create something of the

Re: re.compile versus r''

2008-08-28 Thread Chris Rebert
On Thu, Aug 28, 2008 at 12:23 PM, Terrence Brannon <[EMAIL PROTECTED]> wrote: > Hello, I'm using a tool (PLY) which apparently expects the tokens to > be created using r'' > > But because one token is a rather complex regular expression, I want > to create the regular expression programmatically. >

Re: [Q] How to ignore the first line of the text read from a file

2008-08-28 Thread Marc 'BlackJack' Rintsch
On Thu, 28 Aug 2008 10:16:45 -0700, norseman wrote: > Benjamin Kaplan wrote: >> On Thu, Aug 28, 2008 at 12:11 AM, [EMAIL PROTECTED] < >> [EMAIL PROTECTED]> wrote: >> >>> Hello, >>> >>> I am new to Python and have one simple question to which I cannot find >>> a satisfactory solution. >>> I want t

Re: file data to list

2008-08-28 Thread Emile van Sebille
Anish Chapagain wrote: Hi!! I am facing problem for extracting file data to the list so as to have graph plotted through list. my file(eg: data.txt) is having data like this, cnt0001a 29000 xretya 01 cnt0002a 29850 brishal 02 cnt0003a 31250 kristal 03 from here, I need to copy data 29000, 29850

Re: List of modules available for import inside Python?

2008-08-28 Thread mblume
Am Thu, 28 Aug 2008 11:23:01 -0700 schrieb Jason Scheirer: > > I like to direct new users to pydoc's built-in HTTP server: > > import pydoc > pydoc.gui() > (then click the 'open browser' button) > Now, this is cool ! Thanks a lot! Martin -- http://mail.python.org/mailman/listinfo/python-list

Re: filter in for loop

2008-08-28 Thread Matthew Woodcraft
GHZ <[EMAIL PROTECTED]> writes: > I would like to say something like: > > for filename in os.listdir(DIR) if filename[-4:] == '.xml': > > > > instead of having to say: > > for filename in os.listdir(DIR): > if filename[-4:] == '.xml': > If the reason you don't like this one is t

Re: filter in for loop

2008-08-28 Thread Emile van Sebille
Jerry Hill wrote: On Thu, Aug 28, 2008 at 6:20 AM, GHZ <[EMAIL PROTECTED]> wrote: is there a shortcut I'm missing? import glob Emile -- http://mail.python.org/mailman/listinfo/python-list

Re: Python svn bindings for Subversion?

2008-08-28 Thread Rob Wolfe
Mike B <[EMAIL PROTECTED]> writes: > I'm trying to get Subversion 'hook scripts' working on an Ubuntu box and the > following fails. > > from svn import fs, repos, core, delta > > As far as I can tell there are two Python Subversion libraries, 'pysvn' and > 'svn': > 'pysvn' from http://pysvn.tigri

Re: Python svn bindings for Subversion?

2008-08-28 Thread Matthew Woodcraft
Mike B writes: > I'm trying to get Subversion 'hook scripts' working on an Ubuntu box and the > following fails. > > from svn import fs, repos, core, delta [...] > 'svn' appears to be a SWIG wrapper and could be what I'm looking for, but I > cannot find it anywhere. > > Can anyone point me in the r

Negative regular expressions (searching for "i" not inside command)

2008-08-28 Thread Bart Kastermans
I have a file in which I am searching for the letter "i" (actually a bit more general than that, arbitrary regular expressions could occur) as long as it does not occur inside an expression that matches \\.+?\b (something started by a backslash and including the word that follows). More concrete e

Re: Syntax error in ".py" file and globals variable values not available.

2008-08-28 Thread Timothy Grant
On Thu, Aug 28, 2008 at 1:40 AM, Alexis Boutillier <[EMAIL PROTECTED]> wrote: > Timothy Grant a écrit : >> >> On Wed, Aug 27, 2008 at 2:49 AM, Alexis Boutillier >> <[EMAIL PROTECTED]> wrote: >>> >>> Hi, >>> >>> I have a strange behaviour of python with pdb and import statement. >>> Here is the exam

Re: Descriptor leak in python 2.4 subprocess module

2008-08-28 Thread Michel Lespinasse
On Thu, Aug 28, 2008 at 10:37:48AM +0100, Tim Golden wrote: > Michel Lespinasse wrote: > >I hit an issue with the following python code: > >try: > >get_orient = subprocess.Popen (['jpegexiforient', '-n', pathfull], > > stdin = subprocess.PIPE, > >

Re: Negative regular expressions (searching for "i" not inside command)

2008-08-28 Thread Guilherme Polo
On Thu, Aug 28, 2008 at 5:04 PM, Bart Kastermans <[EMAIL PROTECTED]> wrote: > I have a file in which I am searching for the letter "i" (actually > a bit more general than that, arbitrary regular expressions could > occur) as long as it does not occur inside an expression that matches > \\.+?\b (som

  1   2   >