Re: don't understand popen2

2006-03-22 Thread Martin P. Hellwig
gry@ll.mit.edu wrote: > > You gave it a single string, not a list(sequence) of strings. Try > something like: > std_in.writelines(["notgood"]) > I got this output then: >>> something: Traceback (most recent call last): File "F:\coding\pwSync\popen_test\popen_test.py", line 8, in ?

searching imap mail folder but excluding one subfolder

2006-03-22 Thread Kevin F
I have code that searches under the default folder (inbox) but I would like to modify it to search for everything in that folder with the exception of one subfolder where I would like it not to search. my current code is: from imaplib import * import getpass server = IMAP4("webmail.x.

Re: Programming challenge: wildcard exclusion in cartesian products

2006-03-22 Thread Dirk Thierbach
[EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > What are some good references for finite state machines? Minimization? A classic is "Introduction to automata theory, languages and computation" by Hopcroft and Ullman. But any other book about finite state machines should cover these topics, too. The

__slots__

2006-03-22 Thread David Isaac
1. "Without a __dict__ variable, instances cannot be assigned new variables not listed in the __slots__ definition." So this seemed an interesting restriction to impose in some instances, but I've noticed that this behavior is being called by some a side effect the reliance on which is considered

Re: Good thread pool module

2006-03-22 Thread Kinsley Turner
> There isn't a thread pool module in the standard library, but I'm sure > many have been written by people in the python community. > Anyone have a favorite? Is there one particular implementation that's > recommended? > > Not looking for anything fancy, just something that lets me queue up >

Re: LONG_BIT PROBLEM on Sun Solaris 5.8 linking python

2006-03-22 Thread Martin v. Löwis
Nancy wrote: > I know there are lots of messages about this already posted but Im > seeing this on Solaris 5.8. Sunfire > I'm using the sun compiler. All the other messages blamed it on linux > red hat gcc compilers and glib. Thanks. So what is the value of SIZEOF_LONG in pyconfig.h? When you com

Help: why python odbc module can not fetch all over?

2006-03-22 Thread zxo102
Hi everyone, I need your help for using python odbc module. I have a simple table defined as create table A ( userId char(10), courseid char(10), grade integer, primary key(userId,courseId) ) userIdcourseId grade 1 1001 50 1 1002 89

Embed Mozilla ActiveX Browser Control or MSIE the easy WAY!

2006-03-22 Thread sukhpalsingh
With this little DLL you can embed either Mozilla ActiveX Browser Control or MSIE by just calling it's EmbedBrowser(HWND hwnd, int i[0,1]) function. 0 = Mozilla Activex Browser Control and 1 = MSIE. Other available methods include: >> UnEmbedBrowser() >> ResizeBrowser(HWND hwnd)

Re: Good thread pool module

2006-03-22 Thread Raymond Hettinger
David Hirschfield wrote: > There isn't a thread pool module in the standard library, but I'm sure > many have been written by people in the python community. > Anyone have a favorite? Is there one particular implementation that's > recommended? Because of the GIL, thread pools are not as useful in

Re: C API: Testing my reference counting

2006-03-22 Thread Tim Peters
[lord trousers] >>> Is there a way I can get hold of these kinds of statistics for >>> debugging? [Martin v. Löwis] >> This is best done when Python is build in debug mode. >> sys.gettotalrefcount then gives you the number of INCREF >> calls for which no DECREF has been made; you said that >> this

Re: multiple assignment

2006-03-22 Thread Anand
>> Wouldn't it be nice to say >> id, *tokens = line.split(',') > > > id, tokens_str = line.split(',', 1) But then you have to split tokens_str again. id, tokens_str = line.split(',', 1) tokens = tokens_str.split(',') this is too verbose. anand -- http://mail.python.org/mailman/listinfo/python

removing file by inode

2006-03-22 Thread s99999999s2003
hi this is pertain to unix environment. is it possible to remove a file by it's inode and not it's filename using Python? Just curious... thanks. -- http://mail.python.org/mailman/listinfo/python-list

Re: C API: Testing my reference counting

2006-03-22 Thread lord trousers
Martin v. Löwis wrote: > lord trousers wrote: > > Is there a way I can get hold of these kinds of statistics for > > debugging? > > This is best done when Python is build in debug mode. > sys.gettotalrefcount then gives you the number of INCREF > calls for which no DECREF has been made; you said th

Re: don't understand popen2

2006-03-22 Thread Donn Cave
Quoth gry@ll.mit.edu: | Martin P. Hellwig wrote: ... |> import popen2 |> |> std_out, std_in = popen2.popen2("testia.py") |> |> x=std_out.readline() |> print(x) |> |> std_in.writelines("notgood") |> |> x=std_out.readline() |> print(x) ... |> Traceback (most recent call last): |>File "F:\coding\p

Re: need SOAPpy help

2006-03-22 Thread Ravi Teja
Did you read http://diveintopython.org/soap_web_services/index.html ? and specifically http://diveintopython.org/soap_web_services/introspection.html ? These docs are slightly dated but I doubt much has changed. If there is a problem, you can always try the older version from the site. -- http:/

Re: UML from py sources

2006-03-22 Thread Ravi Teja
Not to interrupt the valuable lesson with Google :-) Boa Constructor. -- http://mail.python.org/mailman/listinfo/python-list

Re: Can't get the real contents form page in internet as the tag "no-chche"

2006-03-22 Thread I V
dongdong wrote: > using web browser can get page's content formally, but when use > urllib2.open("http://tech.163.com/2004w11/12732/2004w11_1100059465339.html";).read() > > the result is > > CONTENT="0;URL=http://tech.163.com/04/1110/12/14QUR2BR0009159H.html";> This line here instructs the browse

Re: Using PyExcelerator

2006-03-22 Thread John Machin
On 23/03/2006 9:01 AM, [EMAIL PROTECTED] wrote: > I have just installed PyExcelerator, and now want to use it to read > Excel spreadsheets with a variable number of rows and columns and with > multiple sheets. Unfortunately, no documentation seems to accompany > PyExcelerator. Does anyone know of a

Re: newbie question

2006-03-22 Thread John Machin
On 23/03/2006 1:53 PM, Kevin F wrote: > what does it mean when there are [0] or [1] after a variable? > > e.g. print 'Message %s\n%s\n' % (num, data[0][1]) Here's the section in the Python Tutorial that should answer your question: http://docs.python.org/tut/node5.html#SECTION0051400

Re: Can't get the real contents form page in internet as the tag "no-chche"

2006-03-22 Thread dongdong
yeah,u r right, the page uses chinese.(I'm a chinese too.^_^,) using urllib2.urlopen('').read(),I can't get the contents between '' and '' ,the reason isn't the chinese encoding but the 'no-cache' set,I think. I want to get the contents between can you find the problem why i can'

Re: years later DeprecationWarning

2006-03-22 Thread Enigma Curry
> (That long-gone guy is actually me, according to the notes in the program. > However those brain cells are long gone now, so it might as well not be me.) I had a great long laugh with this bit. I guess it's because I can relate so well :) -- http://mail.python.org/mailman/listinfo/python-list

newbie question

2006-03-22 Thread Kevin F
what does it mean when there are [0] or [1] after a variable? e.g. print 'Message %s\n%s\n' % (num, data[0][1]) -- http://mail.python.org/mailman/listinfo/python-list

Re: UML from py sources

2006-03-22 Thread skip
sbaush> Hi all, i'm searching for a tool that draw the UML of a python sbaush> project. Have you idea about the best way to do it? I prefer a sbaush> Linux tool, but it's the same, i have only a little bit of sbaush> time... Did you try Googling for "UML from Python"? Skip -- ht

Re: Can't get the real contents form page in internet as the tag "no-chche"

2006-03-22 Thread Kent Johnson
dongdong wrote: > using web browser can get page's content formally, but when use > urllib2.open("http://tech.163.com/2004w11/12732/2004w11_1100059465339.html";).read() > > the result is > > CONTENT="0;URL=http://tech.163.com/04/1110/12/14QUR2BR0009159H.html";> > content="no-cache">?y?ú'ò?aò3??

Re: don't understand popen2

2006-03-22 Thread gry
Martin P. Hellwig wrote: > Hi all, > > I was doing some popen2 tests so that I'm more comfortable using it. > I wrote a little python script to help me test that (testia.py): > > - > someline = raw_input("something:") > > if someline == 'test': > print("yup") >

need SOAPpy help

2006-03-22 Thread Sells, Fred
I've just been asked to do a soap client for some vendor software. I'm able to load the WSDL and discover the methods, but when I go to call a method it doesn't see it. I should be passing in a string that is named "testValue" I've been working from the soap demoes with soappy 0.12.0. I've foun

Can't get the real contents form page in internet as the tag "no-chche"

2006-03-22 Thread dongdong
using web browser can get page's content formally, but when use urllib2.open("http://tech.163.com/2004w11/12732/2004w11_1100059465339.html";).read() the result is http://tech.163.com/04/1110/12/14QUR2BR0009159H.html";> ?y?ú'ò?aò3??... ,I think the reson is the no-cache, are there person would he

Re: import random module

2006-03-22 Thread Carl Banks
Ben Finney wrote: > "DataSmash" <[EMAIL PROTECTED]> writes: > > * random.py: > > > > import random > > Now that you've tripped over this ambiguity of Python's current > 'import' behaviour, you may be interested to know that the behaviour > will change to solve this: > > http://www.python.org/de

Re: Spidering Hacks for Python, not Perl

2006-03-22 Thread John J. Lee
[EMAIL PROTECTED] writes: > O'Reilly's Spidering Hacks books terrific. One problem. All the code > samples are in Perl. Nothing Pythonic. Is there a book out there for > Python which covers spidering / crawling in depth? A fair number of the examples in that book use WWW::Mechanize. I ported tha

Re: Dynamically growing numarray array.

2006-03-22 Thread Carl Banks
Ivan Vinogradov wrote: > Hello All, > > this seems like a trivial problem, but I just can't find an elegant > solution neither by myself, nor with google's help. > > I'd like to be able to keep an array representing coordinates for a > system of points. > Since I'd like to operate on each point's c

Re: python linking

2006-03-22 Thread Serge Orlov
Nancy wrote: > When i link with python2.4.a i get this error. > > ld: Dwarf Error: Invalid or unhandled FORM value: 14. > > I am NOT using the gcc compiler but the linux icc compiler. Google > hits blame it on gcc compiler binutils being out of date. i dont think > thats the problem here. > thank

UML from py sources

2006-03-22 Thread Sbaush
Hi all, i'm searching for a tool that draw the UML of a python project. Have you idea about the best way to do it? I prefer a Linux tool, but it's the same, i have only a little bit of time... -- Sbaush -- Sbaush -- http://mail.python.org/mailman/listinfo/python-list

UML from py sources

2006-03-22 Thread Sbaush
Hi all, i'm searching for a tool that draw the UML of a python project. Have you idea about the best way to do it? I prefer a Linux tool, but it's the same, i have only a little bit of time...-- Sbaush -- http://mail.python.org/mailman/listinfo/python-list

Re: COM Client / Server creation?

2006-03-22 Thread John J. Lee
"Dan" <[EMAIL PROTECTED]> writes: > Ive got the chapter from the net on COM. It looks pretty old, 2000. > Also the very first example in the chapter on COM doesn't seem to work. > Is what I am wanting to do possible with Python? As long as you're doing IDispatch, essentially anything is possible

Re: Use of Python with GDAL. How to speed up ?

2006-03-22 Thread Serge Orlov
Julien Fiore wrote: > Thanks for the psyco information, Serge. > > > 2) Rewrite the code to be vectorized (don't use psyco) Right now your > > code *doesn't* get any speed benefit from numpy > > I do not understand this point. How to rewrite the code ? vectorized code means one operation work on m

don't understand popen2

2006-03-22 Thread Martin P. Hellwig
Hi all, I was doing some popen2 tests so that I'm more comfortable using it. I wrote a little python script to help me test that (testia.py): - someline = raw_input("something:") if someline == 'test': print("yup") else: print("nope") ---

Re: a problem to solve

2006-03-22 Thread [EMAIL PROTECTED]
John Salerno wrote: > Ok, here's a problem I've sort of assigned to myself for fun, but it's > turning out to be quite a pain to wrap my mind around. It's from a > puzzle game. It will help if you look at this image: > > http://www.johnjsal.devisland.net/switches.jpg > > Here's the situation: Each

Re: Uploading files from IE

2006-03-22 Thread Tim Williams (gmail)
On 22/03/06, AB <[EMAIL PROTECTED]> wrote: >> try something like this:> filename = os.path.basename(fullpathname) I tried the following with the same result:myName = ulImage.filenamenewFile = file (os.path.join(upload_dir, os.path.basename(myName)), 'wb')Any other ideas?  Seems like it shouldn't be

Re: Uploading files from IE

2006-03-22 Thread AB
"Irmen de Jong" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > AB wrote: >> All right... I already hated IE. But, now I do even more. My scripts >> upload function is working in Firefox, but not in IE. If I upload a file >> from Internet Explorer I get a file on the system nam

Re: a problem to solve

2006-03-22 Thread Claudio Grondi
John Salerno wrote: > Ok, here's a problem I've sort of assigned to myself for fun, but it's > turning out to be quite a pain to wrap my mind around. It's from a > puzzle game. It will help if you look at this image: > > http://www.johnjsal.devisland.net/switches.jpg > > Here's the situation: E

Re: Why "class exceptions" are not deprecated?

2006-03-22 Thread rurpy
Fredrik Lundh wrote: > Gregory Petrosyan wrote: > > > 1) From 2.4.2 documentation: > > There are two new valid (semantic) forms for the raise statement: > > raise Class, instance > > raise instance > > > > 2) In python: > > >>> raise NameError > > Traceback (most recent call last): > > File "",

Re: Python equivalent of Perl-ISAPI?

2006-03-22 Thread rurpy
[EMAIL PROTECTED] wrote: > Atanas Banov wrote: > > [EMAIL PROTECTED] wrote: > > > Steve Holden wrote: > > > > [EMAIL PROTECTED] wrote: > > > > > > > > Pure cgi is too slow. "Active Scripting" means ASP, yes? > > > > > I need something that will do cgi scripts (a lot of which I already > > > > > h

Re: reading binary data written in C

2006-03-22 Thread Sheldon
Thanks, I later discovered that it was a big edian binary as well. Sheldon -- http://mail.python.org/mailman/listinfo/python-list

LONG_BIT PROBLEM on Sun Solaris 5.8 linking python

2006-03-22 Thread Nancy
I know there are lots of messages about this already posted but Im seeing this on Solaris 5.8. Sunfire I'm using the sun compiler. All the other messages blamed it on linux red hat gcc compilers and glib. Thanks. "/depot/Python-2.4/include/python2.4/pyport.h", line 612: #error: "LONG_BIT definiti

Re: years later DeprecationWarning

2006-03-22 Thread Ben Finney
Dan Jacobson <[EMAIL PROTECTED]> writes: > Here's the deal: I have to maintain this long gone guy's programs and > lately they've been saying > ./north_pass.py:14: DeprecationWarning: integer argument expected, got float > fl=range(1000*(math.floor(25000*f2m/1000)),46000*f2m,1000) You haven't s

Re: Getting a loop to activate a loop above it

2006-03-22 Thread Terry Hancock
On 22 Mar 2006 13:07:33 -0800 "Byte" <[EMAIL PROTECTED]> wrote: > The following code will not work for me: > > x = 1 > > while x == 1: > print 'hello' > x = input('What is x now?: ') > > while x == 2: > print 'hello again' > x == input('What is x now?: ') > > The second loop dos

Re: Good thread pool module

2006-03-22 Thread Steve M
I believe "Python in a Nutshell" has a couple of clear examples using Queue and Threading, including one with a pool of worker threads that wait for entries in one queue and place results in another. Also you should look at the Python Cookbook, which probably includes the same or similar examples

Re: Good thread pool module

2006-03-22 Thread Rune Hansen
I think you want the Queue module in standard lib. Haven't started a thread yet without it :) regards /rune -- http://mail.python.org/mailman/listinfo/python-list

Re: Uploading files from IE

2006-03-22 Thread Irmen de Jong
AB wrote: > All right... I already hated IE. But, now I do even more. My scripts > upload function is working in Firefox, but not in IE. If I upload a file > from Internet Explorer I get a file on the system named for the full path > from the users computer... > > example... > They user uplo

Re: Programming challenge: wildcard exclusion in cartesian products

2006-03-22 Thread [EMAIL PROTECTED]
"And it doesn't really matter what language you use to implement this algorithm, it's the idea that counts. Notation aside, all implementations will be quite similar." I'll guess I'll get out my Turing tape. ;) What are some good references for finite state machines? Minimization? -- http://mai

Re: Why TypeError: 'str' object is not callable?

2006-03-22 Thread James Stroud
Randall Parker wrote: > Using Python 2.4.2 on Windows 2000 in SPE. > > Getting: > TypeError: 'str' object is not callable > > on this line: > > TmpErrMsg1 = "State machine %s " (StateMachineName) > > In Winpdb 1.0.6 the StateMachineName is of type str in the Namespace | > Local window of local

Good thread pool module

2006-03-22 Thread David Hirschfield
There isn't a thread pool module in the standard library, but I'm sure many have been written by people in the python community. Anyone have a favorite? Is there one particular implementation that's recommended? Not looking for anything fancy, just something that lets me queue up tasks to be pe

Re: import random module

2006-03-22 Thread Ben Finney
"DataSmash" <[EMAIL PROTECTED]> writes: > * random.py: > > import random Now that you've tripped over this ambiguity of Python's current 'import' behaviour, you may be interested to know that the behaviour will change to solve this: http://www.python.org/dev/peps/pep-0328/> In brief: Python

Re: doctest, unittest, or if __name__='__main__'

2006-03-22 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, john_sips_tea wrote: > For writing testcode, it looks like there's three ways that it's > typically done: > > (1). using the doctest module, > > (2). using the unittest module (i.e. "pyunit"), or else > > (3). just putting an "if __name__ = '__main__':" at the bottom of

Re: parsing downloaded mail via POP3

2006-03-22 Thread Gerard Flanagan
Kevin F wrote: > I have the following script: > > emails = [] > for msg in messagesInfo: > msgNum = int(msg.split()[0]) > msgSize = int(msg.split()[1]) > if(msgSize < 2): > message = server.retr(msgNum)[1] > Message = join(message, "\n") > ema

Using PyExcelerator

2006-03-22 Thread tkpmep
I have just installed PyExcelerator, and now want to use it to read Excel spreadsheets with a variable number of rows and columns and with multiple sheets. Unfortunately, no documentation seems to accompany PyExcelerator. Does anyone know of a good source of documentations and/or examples? The auth

Re: years later DeprecationWarning

2006-03-22 Thread Chris Lasher
Two things: 1) math.floor returns a float, not an int. Doing an int() conversion on a float already floors the value, anyways. Try replacing math.floor(...) with int(...) e.g. >>> math.floor(5.9) 5.0 >>> int(5.9) 5 2) What kind of data is in f2m? If f2m is a float, you will get float values in the

Re: years later DeprecationWarning

2006-03-22 Thread Terry Reedy
"Dan Jacobson" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Here's the deal: I have to maintain this long gone guy's programs and > lately they've been saying > ./north_pass.py:14: DeprecationWarning: integer argument expected, got > float > fl=range(1000*(math.floor(25000*f2m/

Re: SWIGing problem

2006-03-22 Thread Robert Kern
Tommy Grav wrote: > This might not be the venue to ask this but I do not know where else to > turn. > I am trying to install a package that is swig'ed from some C code. > Unfortunately the readme file isn't to informative. Does anyone > know which libraries to link to to remove the undefined sym

Re: Need help with restricting number of new objects a user script can create

2006-03-22 Thread Sybren Stuvel
vj enlightened us with: > Run using lua generates: > > Fatal error: Allowed memory size of 8388608 bytes exhausted (tried > to allocate 35 bytes) in > /home/groups/d/do/doris/htdocs/lua/weblua.php on line 109 Ehm... this can also be done with Python & ulimit. Sybren -- The problem with the worl

SWIGing problem

2006-03-22 Thread Tommy Grav
This might not be the venue to ask this but I do not know where else to turn. I am trying to install a package that is swig'ed from some C code. Unfortunately the readme file isn't to informative.  Does anyoneknow which libraries to link to to remove the undefined symbolsbelow?[EMAIL PROTECTED] Pyt

python linking

2006-03-22 Thread Nancy
When i link with python2.4.a i get this error. ld: Dwarf Error: Invalid or unhandled FORM value: 14. I am NOT using the gcc compiler but the linux icc compiler. Google hits blame it on gcc compiler binutils being out of date. i dont think thats the problem here. thanks. -- http://mail.python.o

ANN: SCSIPYTHON on Sourceforge

2006-03-22 Thread sam
I have updated and moved my SCSI diagnostic tools from starship to sourceforge. I will be still maintaining these files at both locations as long as starship exists. These tools allow low level tests to be conducted on storage devices under the Windows operating system. These routines access all st

Re: Convert (sorted) list of dics to nested list ?

2006-03-22 Thread Gerard Flanagan
[EMAIL PROTECTED] wrote: > Hi - I want to take something like ... > > lstIn = [] > lstIn.append({'COM_AUTOID': 1, 'PRG_AUTOID': 10, 'LEA_AUTOID': 1000}) > lstIn.append({'COM_AUTOID': 1, 'PRG_AUTOID': 11, 'LEA_AUTOID': 2000}) > lstIn.append({'COM_AUTOID': 1, 'PRG_AUTOID': 11, 'LEA_AUTOID': 2001}) >

years later DeprecationWarning

2006-03-22 Thread Dan Jacobson
Here's the deal: I have to maintain this long gone guy's programs and lately they've been saying ./north_pass.py:14: DeprecationWarning: integer argument expected, got float fl=range(1000*(math.floor(25000*f2m/1000)),46000*f2m,1000) As I don't know python, I tried sticking an int( ) in various p

Re: Getting a loop to activate a loop above it

2006-03-22 Thread Jordan Greenberg
x=1 while not x==3: if x==1: print 'hello' x = input('what is x now?: ') if x==2: print 'hello again' x=input('what is x now?: ') any code you want to repeat needs to be in some sort of a loop structure. Program execution doesn't just jump around unless you t

Re: Per instance descriptors ?

2006-03-22 Thread Michael Spencer
Bruno Desthuilliers wrote: > Michael Spencer a écrit : >> I may be missing the subtlety of what you're up to, but why is >> overriding __getattribute__ more desirable than simply defining the >> descriptor in a subclass? > > The code snippet I gave as an example was not supposed to reflect how

Uploading files from IE

2006-03-22 Thread AB
All right... I already hated IE. But, now I do even more. My scripts upload function is working in Firefox, but not in IE. If I upload a file from Internet Explorer I get a file on the system named for the full path from the users computer... example... They user uploads C:\mydocs\test.jpg i

Re: Server.sendmail with no "to_addrs" parameter.

2006-03-22 Thread Jim Segrave
In article <[EMAIL PROTECTED]>, Jeffrey Froman <[EMAIL PROTECTED]> wrote: >EdWhyatt wrote: > >> But are you serious about that RFC Compliant thing? > >RFC 2822 obsoletes RFC 822, and I don't know of any specification in RFC >2822 that requires an email address to be present in the To: header. My >

Re: COM Client / Server creation?

2006-03-22 Thread Dan
Ive got the chapter from the net on COM. It looks pretty old, 2000. Also the very first example in the chapter on COM doesn't seem to work. Is what I am wanting to do possible with Python? -- http://mail.python.org/mailman/listinfo/python-list

Re: Server.sendmail with no "to_addrs" parameter.

2006-03-22 Thread Jim Segrave
In article <[EMAIL PROTECTED]>, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: >On 22 Mar 2006 08:31:16 -0800, "EdWhyatt" <[EMAIL PROTECTED]> >declaimed the following in comp.lang.python: > >> So it's a restriction of Python? >> > RFC822 is the /standard/ (well, there are newer versions -- 282

Getting a loop to activate a loop above it

2006-03-22 Thread Byte
The following code will not work for me: x = 1 while x == 1: print 'hello' x = input('What is x now?: ') while x == 2: print 'hello again' x == input('What is x now?: ') The second loop dose not seem to be able to activate the loop above it Proof from my command line: $ pyt

Re: COM Client / Server creation?

2006-03-22 Thread Rene Pijlman
Dan: >New to python. Running under windows xp. Need help getting started >writing COM server and client. Highly recommended: http://safari.oreilly.com/?XmlId=1-56592-621-8 -- http://mail.python.org/mailman/listinfo/python-list

Re: Per instance descriptors ?

2006-03-22 Thread Steven Bethard
bruno at modulix wrote: > Hi > > I'm currently playing with some (possibly weird...) code, and I'd have a > use for per-instance descriptors, ie (dummy code): > > class DummyDescriptor(object): > def __get__(self, obj, objtype=None): > if obj is None: > return self > return getatt

parsing downloaded mail via POP3

2006-03-22 Thread Kevin F
I have the following script: emails = [] for msg in messagesInfo: msgNum = int(msg.split()[0]) msgSize = int(msg.split()[1]) if(msgSize < 2): message = server.retr(msgNum)[1] Message = join(message, “\n”) emails.append(message) It downloads

COM Client / Server creation?

2006-03-22 Thread Dan
New to python. Running under windows xp. Need help getting started writing COM server and client. Want to basically have two interfaces on the server, register() and fire_event1(). register registers a client to receive the fire_event1() event. The client will then need an event handler implemented

Re: read a file line by line using readline()

2006-03-22 Thread Bruno Desthuilliers
Phoe6 a écrit : > Hi all, > I just read the manual and got to know I can use a for loop to iterate > through the lines in the file. > > But so far, I was strugling with the following: > > import os > file = open('File1.txt','r') 'file' is the builtin type for file objects (like the one returned

Re: Dynamically growing numarray array.

2006-03-22 Thread Robert Kern
Ivan Vinogradov wrote: > Hello All, > > this seems like a trivial problem, but I just can't find an elegant > solution neither by myself, nor with google's help. > > I'd like to be able to keep an array representing coordinates for a > system of points. > Since I'd like to operate on each poi

Re: multiple assignment

2006-03-22 Thread Steven Bethard
Anand wrote: > Wouldn't it be nice to say > > id, *tokens = line.split(',') id, tokens_str = line.split(',', 1) STeVe -- http://mail.python.org/mailman/listinfo/python-list

Louie + Twisted

2006-03-22 Thread Richard Townsend
I recently came across the Louie package (http://louie.berlios.de/) I am particularly interested in the TwistedDispatchPlugin, however the documentation is very sparse. Does anyone have some example code showing how to use it, please? -- Richard -- http://mail.python.org/mailman/listinfo/pyth

Re: Per instance descriptors ?

2006-03-22 Thread Bruno Desthuilliers
Michael Spencer a écrit : > bruno at modulix wrote: > >> Ziga Seilnacht wrote: >> >>> bruno at modulix wrote: >>> Hi I'm currently playing with some (possibly weird...) code, and I'd have a use for per-instance descriptors, ie (dummy code): >>> >>> >>> >>> Now the q

Re: Why TypeError: 'str' object is not callable?

2006-03-22 Thread Randall Parker
Argh! I do not know what happened to the percent signs. They used to be there. Sorry to waste the time of so many people. -- http://mail.python.org/mailman/listinfo/python-list

Re: Why TypeError: 'str' object is not callable?

2006-03-22 Thread Kent Johnson
Carl J. Van Arsdall wrote: > Randall Parker wrote: >> >>Getting: >>TypeError: 'str' object is not callable >> >>on this line: >> >> > > You have a boo boo > > >>TmpErrMsg1 = "State machine %s " (StateMachineName) >> > > Should be > > TmpErrMsg1 = "State machine %s " %(StateMachineName) An

Dynamically growing numarray array.

2006-03-22 Thread Ivan Vinogradov
Hello All, this seems like a trivial problem, but I just can't find an elegant solution neither by myself, nor with google's help. I'd like to be able to keep an array representing coordinates for a system of points. Since I'd like to operate on each point's coordinates individually, for sp

Re: RPC client class?

2006-03-22 Thread Richard Tew
>From Dick Watson: > We have a legacy device that exposes an RPC server. We have an RPCL > defininition of its interface. We want to develop an RPC client of this > interface in Python that will be usable in both Win32 and open systems > environments. > > I can find some *very* dated references to

a problem to solve

2006-03-22 Thread John Salerno
Ok, here's a problem I've sort of assigned to myself for fun, but it's turning out to be quite a pain to wrap my mind around. It's from a puzzle game. It will help if you look at this image: http://www.johnjsal.devisland.net/switches.jpg Here's the situation: Each of the four rows in the diagra

Re: Why TypeError: 'str' object is not callable?

2006-03-22 Thread Richard Townsend
On 22 Mar 2006 12:10:49 -0800, Randall Parker wrote: > > TmpErrMsg1 = "State machine %s " (StateMachineName) > TmpErrMsg1 = "State machine %s " % (StateMachineName) -- Richard -- http://mail.python.org/mailman/listinfo/python-list

Re: Why TypeError: 'str' object is not callable?

2006-03-22 Thread Carl J. Van Arsdall
Randall Parker wrote: > Using Python 2.4.2 on Windows 2000 in SPE. > > Getting: > TypeError: 'str' object is not callable > > on this line: > > You have a boo boo > TmpErrMsg1 = "State machine %s " (StateMachineName) > Should be TmpErrMsg1 = "State machine %s " %(StateMachineName) > In W

Why TypeError: 'str' object is not callable?

2006-03-22 Thread Randall Parker
Using Python 2.4.2 on Windows 2000 in SPE. Getting: TypeError: 'str' object is not callable on this line: TmpErrMsg1 = "State machine %s " (StateMachineName) In Winpdb 1.0.6 the StateMachineName is of type str in the Namespace | Local window of local variables. It even has the string value I ex

Re: Trouble with generator as method

2006-03-22 Thread Peter Cole
Peter Otten wrote: > Peter Cole wrote: > >> I'm having difficulty understanding why this doesn't work: > >> import sys, new, inspect >> >> class T: >> def foo(self): >> yield 1 >> yield 2 >> yield 3 >> >> >> t = T() > > im = new.instancemethod(T.foo, t, T) > >> prin

Re: Wrap a dictionary in a class?

2006-03-22 Thread Michael Spencer
Joseph Turian wrote: > In another thread, it was recommended that I wrap a dictionary in a > class. > How do I do so? > >Joseph > > that thread: > http://groups.google.com/group/comp.lang.python/browse_frm/thread/9a0fbdca450469a1/b18455aa8dbceb8a?q=turian&rnum=1#b18455aa8dbceb8a > Perhaps li

Re: Per instance descriptors ?

2006-03-22 Thread Michael Spencer
bruno at modulix wrote: > Ziga Seilnacht wrote: >> bruno at modulix wrote: >> >>> Hi >>> >>> I'm currently playing with some (possibly weird...) code, and I'd have a >>> use for per-instance descriptors, ie (dummy code): >> >> >> >>> Now the question: is there any obvious (or non-obvious) drawback

Re: Newbie: Print question

2006-03-22 Thread Tommy Grav
Thanks. That works. Like I said I am a newbie :)Cheers  TommyOn Mar 22, 2006, at 1:17 PM, Fredrik Lundh wrote:Tommy Grav wrote:      for testobs in obslist:         print testobs.printmpc() print.      def printmpc(self):         if self.mag!="":             print "%14s  %12.5f  %5.2f  %6.2f  %8.3f

Re: Conversion from string to integer

2006-03-22 Thread Mark Warburton
Grant Edwards wrote: > On 2006-03-22, Mark Warburton <[EMAIL PROTECTED]> wrote: > > Ahh, right. Batteries included! Thanks for the enlightenment. :) > > I think that's the third time _today_ that question has been > answered. Where can we put that information such that you > would have found it

Re: Need help with restricting number of new objects a user script can create

2006-03-22 Thread vj
I think the only option is to come up with my own mini language. Searching on google, I found several examples where people replaced python with lua for scripting. Am reading up on lua and looks very promissing. I also tried doing the following: for i=1,1 do print(i) end on: http://doris.

Re: Conversion from string to integer

2006-03-22 Thread Grant Edwards
On 2006-03-22, Mark Warburton <[EMAIL PROTECTED]> wrote: > Peter Otten wrote: >> To convert them you need struct.unpack() > > Ahh, right. Batteries included! Thanks for the enlightenment. :) I think that's the third time _today_ that question has been answered. Where can we put that informatio

Re: Newbie: Print question

2006-03-22 Thread xkenneth
doesnt look like you're passing any data to the print statement, shouldn't it be something like print '%d' % 4 output: 4\n -- http://mail.python.org/mailman/listinfo/python-list

Re: Objective Cairo

2006-03-22 Thread Paul Boddie
[EMAIL PROTECTED] wrote: > As pycairo is one of the less pythonish things I ever saw, it went into > my mind to create some sort of objective wrapper over its python api > making graphic manipulation much more coherent to the python way. [...] > Before going on with more complex forms and objects

Re: Conversion from string to integer

2006-03-22 Thread Mark Warburton
Peter Otten wrote: > To convert them you need struct.unpack() Ahh, right. Batteries included! Thanks for the enlightenment. :) -- http://mail.python.org/mailman/listinfo/python-list

Re: Conversion from string to integer

2006-03-22 Thread Mark Warburton
You want something like this: >>> a = '\x1dz' >>> (ord(a[0])<<8) + ord(a[1]) 7546 Each of the two characters represents one byte of a 16-bit integer. It doesn't matter if they are ascii or hex -- there are still exactly two bytes in each of your strings. The ord() function converts a character

  1   2   3   >