Re: Where to find python c-sources

2005-09-29 Thread Max M
python.org. Are people really too lazy > to do elementary research on Google? Don't know, have you checked Google? -- hilsen/regards Max M, Denmark http://www.mxm.dk/ IT's Mad Science -- http://mail.python.org/mailman/listinfo/python-list

Re: New project coming up...stay with Python, or go with a dot net language??? Your thoughts please!

2005-10-04 Thread Max M
ot net > language? Hehe ... I can run my very first Python program right now in the current version of Python. I cannot even find a platform to run my .asp code from that same timeframe ... So much for 'safe'! -- hilsen/regards Max M, Denmark http://www.mxm.dk/ IT's Mad

Re: Python reliability

2005-10-10 Thread Max M
ould have crashed your system. That should be an indicator: http://www.python.org/2.4.2/NEWS.html -- hilsen/regards Max M, Denmark http://www.mxm.dk/ IT's Mad Science -- http://mail.python.org/mailman/listinfo/python-list

Windows installer, different versions of Python on Windows

2005-10-10 Thread Max M
erent versions of Zope 3, and since it is installed under a specific python version, the simplest solution would be to install several Python versions, and install a different zope3 version under each python install. Have I misunderstood something here? -- hilsen/regards Max M, Denmark http://www.m

Re: How to do *args, **kwargs properly

2005-10-11 Thread Max M
ptions): for key in options.keys(): if not key in FN_LEGAL_ARGS: raise TypeError, "'%s' is an invalid keyword argument for this function" % key -- hilsen/regards Max M, Denmark http://www.mxm.dk/ IT's Mad Science -- http://mail.python.org/mailman/listinfo/python-list

Re: How to do *args, **kwargs properly

2005-10-11 Thread Max M
Lasse Vågsæther Karlsen wrote: > Max M wrote: > So what you're saying is that instead of: > > def fn(*values, **options): > > I should use: > > def fn(values, cmp=cmp): > > in this specific case? > > and then instead of: > > fn(1, 2

Re: Python vs Ruby

2005-10-23 Thread Max M
e program in > less time. In my experience the LOC count is *far* less significant than the levels of indirections. Eg. how many levels of abstraction do I have to understand to follow a traceback, or to understand what a method relly does in a complex system. -- hilsen/regards Max M

Re: Sending email in utf-8?

2005-11-08 Thread Max M
success = 0 try: cleaner = lambda adresses: [adress.strip() for adress in adresses.split(',') if adress.strip()] all_receivers = cleaner(to) + cleaner(cc) + cleaner(bcc) all_receivers = list(set(all_receivers)) if all_receivers: # only send if any recipients self._mailhost().send(str(msg), mto=all_receivers, mfrom=mfrom) success = 1 except: pass -- hilsen/regards Max M, Denmark http://www.mxm.dk/ IT's Mad Science -- http://mail.python.org/mailman/listinfo/python-list

Re: append to non-existing list

2005-11-09 Thread Max M
guess that's normal as it's the way python works...?!? Well you could do something like this. (Untested and unrecommended) self.__dict__.setdefault('pkcolumns', []).append(row[0].strip()) Personally I find pkcolumns = [] pkcolumns .append(row[0].strip()) to be nicer ;-) -- hilsen/regards Max M, Denmark http://www.mxm.dk/ IT's Mad Science -- http://mail.python.org/mailman/listinfo/python-list

Re: Python Midi Package: writing events non-chronologically

2005-11-24 Thread Max M
structure is then is complete, you use the midi library to write it to disk. I have attached a simple example here. -- hilsen/regards Max M, Denmark http://www.mxm.dk/ IT's Mad Science # event classes. Only used internally by notes2midi class NoteOn: def __init__(self, time=0, pit

Re: Calling Function Without Parentheses!

2005-01-02 Thread Max M
a('default result') -- hilsen/regards Max M, Denmark http://www.mxm.dk/ IT's Mad Science -- http://mail.python.org/mailman/listinfo/python-list

Re: csh to Python

2005-01-04 Thread Max M
Nader Emami wrote: Hello, I am new in Python world, and would like to begin with translate a csh file to a python script. Could somebody give me an advise (documentation or web-site) where I can do that. You are probably interrested in the os 6 os.path modules. -- hilsen/regards Max M, Denmark

Re: Dr. Dobb's Python-URL! - weekly Python news and links (Dec 30)

2005-01-04 Thread Max M
unicode string into a special string/file format # and you can decode a string from a special string/file format back into unicode. ### u'Some danish characters \xe6\xf8\xe5' 'Some danish characters \xe6\xf8\xe5' Some danish characters æøå

Re: Dr. Dobb's Python-URL! - weekly Python news and links (Dec 30)

2005-01-04 Thread Max M
range(128) Hm, why does the 'encode' call complain about decoding? Because it tries to print it out to your console and fail. While writing to the console it tries to convert to ascii. Beside, you should write: u"ä".encode("latin-1") to get a latin-1 encoded stri

Re: Dr. Dobb's Python-URL! - weekly Python news and links (Dec 30)

2005-01-05 Thread Max M
code('utf-8') >>u'INBOX' Tn that case id.decode('hex') doesn't return a unicode, but a utf-8 encoded string. -- hilsen/regards Max M, Denmark http://www.mxm.dk/ IT's Mad Science -- http://mail.python.org/mailman/listinfo/python-list

Re: smtp question

2005-01-05 Thread Max M
t;> msg.set_payload(body) Thats all. Though some smtp servers needs a Date header too, to work. >>> from time import gmtime, strftime >>> msg['Date'] = strftime("%a, %d %b %Y %H:%M:%S +", gmtime()) Sending the message via the smtp module is even simpler. >>> import smtplib >>> server = smtplib.SMTP('localhost') >>> server.sendmail(fromaddr, [to], msg.as_string()) >>> server.quit() -- hilsen/regards Max M, Denmark http://www.mxm.dk/ IT's Mad Science -- http://mail.python.org/mailman/listinfo/python-list

Returning same type as self for arithmetic in subclasses

2005-01-07 Thread Max M
thods? """ from datetime import datetime, timedelta class myDatetime(datetime): pass class myTimedelta(timedelta): pass if __name__ == "__main__": import os.path, doctest, dtime # import and test this file doctest.testmod(dtime) -- hilsen/regards Max M, Denmark http://www.mxm.dk/ IT's Mad Science -- http://mail.python.org/mailman/listinfo/python-list

Re: Returning same type as self for arithmetic in subclasses

2005-01-08 Thread Max M
))) except: raise ValueError, 'Wrong format' return vDatetime(*timetuple) fromstring = staticmethod(fromstring) def __str__(self): return self.strftime("%Y%m%dT%H%M%S") -- hilsen/regards Max M, Denmark http://www.mxm.dk/ IT's Mad Science -- http://mail.python.org/mailman/listinfo/python-list

Re: Another look at language comparisons

2005-01-08 Thread Max M
Jan Dries wrote: [EMAIL PROTECTED] wrote: And there is hope for Python, as Guido has recently been seen with a beard :-) http://www.tbray.org/ongoing/When/200x/2004/12/08/-big/IMG_3061.jpg LOL, he is working on linux, isn't he? So it was about bloody time. -- hilsen/regards Max M, Denmark

Re: Weekly Python Patch/Bug Summary

2005-01-08 Thread Max M
Kurt B. Kaiser wrote: Remove witty comment in pydoc.py (2005-01-01) CLOSED http://python.org/sf/1094007 opened by Reinhold Birkenfeld This is not a joke? :-) -- hilsen/regards Max M, Denmark http://www.mxm.dk/ IT's Mad Science -- http://mail.python.org/mailman/listinfo/python-list

oddities in the datetime module

2005-01-14 Thread Max M
etimetuple) class date2(date): def datetimetuple(self): return self.timetuple()[:6] + (0, None) def from_datetimetuple(dt_tuple): return date2(*dt_tuple[:3]) from_datetimetuple = staticmethod(from_datetimetuple) #from datetime import datetime # #ical = Calendar() #print ical.ical() if

Re: oddities in the datetime module

2005-01-14 Thread Max M
Serge Orlov wrote: Max M wrote: Yes, you did. datetime.timetuple is those who want *time module* format, you should use datetime.data, datetime.time, datetime.year and so on... As they say, if the only tool you have is timetuple, everything looks like tuple Try this: dt = datetime(2005, 1, 1

[ANN] iCalendar package 0.9

2005-01-17 Thread Max M
Api is pretty stable, and will probably not change much. I would like anybody interrested to give it a test drive before I finish it off and make it a 1.0. http://www.mxm.dk/products/public/ical/ Any feedback would be welcome. -- hilsen/regards Max M, Denmark http://www.mxm.dk/ IT's Mad Sc

Re: [ANN] iCalendar package 0.9

2005-01-18 Thread Max M
Roger Binns wrote: "Max M" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] http://www.mxm.dk/products/public/ical/ Any feedback would be welcome. How well do you cope with the crud that real programs generate? Does it work with the different dialects uses out there?

Re: find isset() php function equivalent in python

2005-02-01 Thread Max M
bad practice to do it like that. If you need variables that you don't know that name of, you should put them in a dictionary. They are made for that exact purpose. >>> unkown_vars = {} >>> unkown_vars['variable'] = 42 >>> 'variable' in unkown

Re: Remove HTML tags (except anchor tag) from a string using regular expressions

2005-02-01 Thread Max M
Nico Grubert wrote: If it's not to learn, and you simply want it to work, try out this library: http://zope.org/Members/chrisw/StripOGram/readme -- hilsen/regards Max M, Denmark http://www.mxm.dk/ IT's Mad Science -- http://mail.python.org/mailman/listinfo/python-list

Re: Printing Filenames with non-Ascii-Characters

2005-02-02 Thread Max M
g cookie in your file? Try adding this as the first or second line. # -*- coding: cp850 -*- Python will then know how your file is encoded -- hilsen/regards Max M, Denmark http://www.mxm.dk/ IT's Mad Science -- http://mail.python.org/mailman/listinfo/python-list

Re: Boss wants me to program

2005-06-28 Thread Max M
ll not be as > mysterious or dangerous. I agree. The language is more important than the gui. It is not very hard to make good applikations in eg. Tkinter, and you will understand evey part of it. -- hilsen/regards Max M, Denmark http://www.mxm.dk/ IT's Mad Science -- http://mail.python.

Re: Modules for inclusion in standard library?

2005-07-01 Thread Max M
gestion to start with. ctypes certainly. Even though it can crash Python. People using ctypes would be aware of this. Another good bet is BeautifulSoup, which is absolutely great for scraping content from webpages. http://crummy.com/software/BeautifulSoup/index.html -- hilsen/regards

Re: What are the other options against Zope?

2005-07-04 Thread Max M
objects can then be called eg. from a web browser with different parameters. But you can also use other protocols than http like dav, ftp etc. This is a very effective way to build web applications, and does not need sql-object remapping as normal web apps does. -- hilsen/regards Max

Re: f*cking re module

2005-07-04 Thread Max M
rom a reference! If you want to try out re interactively you could use: \Tools\Scripts\redemo.py -- hilsen/regards Max M, Denmark http://www.mxm.dk/ IT's Mad Science -- http://mail.python.org/mailman/listinfo/python-list

Re: mail sending using telnet in python

2005-07-08 Thread Max M
on but I cann't > get solution for it. Why not just use the smtp module? It's a tad easier. -- hilsen/regards Max M, Denmark http://www.mxm.dk/ IT's Mad Science -- http://mail.python.org/mailman/listinfo/python-list

Re: Unix diff command under Window.

2005-08-25 Thread Max M
TonyHa wrote: > Hello, > > Does any one have using Python to write a Unix "diff" command for > Window? I generally just us the diff built into tortoiseSVN. That way it's only a rightclick away. -- hilsen/regards Max M, Denmark http://www.mxm.dk/ IT's Mad Sc

Re: ANN: PyDev 0.9.8 released

2005-08-30 Thread Max M
ing to it, I just wondered what experiences other users might have when using it for production. Being that my text editing environment is my bread and butter. Is it stable/effective etc? Anybody cares to share? -- hilsen/regards Max M, Denmark http://www.mxm.dk/ IT's Mad Science --

Re: ANN: PyDev 0.9.8 released

2005-08-30 Thread Max M
ojects (my current ambient has about 400 python modules, all > managed in pydev). Also, there are no current bug reports for any > instability in pydev. Ok. I am starting a new product for Plone tomorrow, that should take about a week to finish. I will try switching cold-turkey to pyd

Re: brain cramp: emulating cgi.FieldStorage

2005-09-15 Thread Max M
blank strings. The default false value indicates that blank values are to be ignored and treated as if they were not included. strict_parsing: flag indicating what to do with parsing errors. If false (the default), errors are silently ignored.

Re: IDE, widget library

2005-09-16 Thread Max M
ob on pydev! -- hilsen/regards Max M, Denmark http://www.mxm.dk/ IT's Mad Science -- http://mail.python.org/mailman/listinfo/python-list

Re: dictionary to file

2005-09-16 Thread Max M
and save that to a file. http://docs.python.org/lib/module-pickle.html -- hilsen/regards Max M, Denmark http://www.mxm.dk/ IT's Mad Science -- http://mail.python.org/mailman/listinfo/python-list

Re: C#3.0 and lambdas

2005-09-19 Thread Max M
s it would normally look: def func(*arg) That should work just as well for those cases. -- hilsen/regards Max M, Denmark http://www.mxm.dk/ IT's Mad Science -- http://mail.python.org/mailman/listinfo/python-list

Re: Convert from unicode to int

2005-09-22 Thread Max M
Tor Erik Sønvisen wrote: > Hi > > Is there any simpler way to convert a unicode numeric to an int than: > > int(u'1024'.encode('ascii')) why doesn't: int(u'104') work for you? -- hilsen/regards Max M, Denmark http://www.mxm.dk/ I

Re: Is Python as capable as Perl for sysadmin work?

2005-02-08 Thread Max M
x27;t work. You have to suggest that it 'try ... except', which is really offensive. If I want to beg my computer to run programs, I know where to find Intercal with its "PLEASE" and "DO PLEASE" constructions. Wasn't there talk about a "try harder" recently

Re: Big development in the GUI realm

2005-02-11 Thread Max M
developing something like a desktop application that you want to sell for money, using the GPL is a bad idea. -- hilsen/regards Max M, Denmark http://www.mxm.dk/ IT's Mad Science -- http://mail.python.org/mailman/listinfo/python-list

Re: Why doesn't join() call str() on its arguments?

2005-02-17 Thread Max M
7; Is this really that hard to do, that you want it in the library? -- hilsen/regards Max M, Denmark http://www.mxm.dk/ IT's Mad Science -- http://mail.python.org/mailman/listinfo/python-list

Re: tiff via email-module

2005-02-17 Thread Max M
.append(part.get_payload(decode=1)) return attachments return [] -- hilsen/regards Max M, Denmark http://www.mxm.dk/ IT's Mad Science -- http://mail.python.org/mailman/listinfo/python-list

Re: Copy functio in imaplib

2005-02-22 Thread Max M
a string. In one of the forms: '1,2,3,4' or '1:4' The numbers can be either message sequence numbers or uids. -- hilsen/regards Max M, Denmark http://www.mxm.dk/ IT's Mad Science -- http://mail.python.org/mailman/listinfo/python-list

Re: UTF-8 / German, Scandinavian letters - is it really this difficult?? Linux & Windows XP

2005-02-22 Thread Max M
g an encoding: ust = unicode(st) -- hilsen/regards Max M, Denmark http://www.mxm.dk/ IT's Mad Science -- http://mail.python.org/mailman/listinfo/python-list

Re: Explicit or general importing of namespaces?

2005-02-28 Thread Max M
able. -- hilsen/regards Max M, Denmark http://www.mxm.dk/ IT's Mad Science -- http://mail.python.org/mailman/listinfo/python-list

Re: [Python-Dev] Re: python-dev Summary for 2005-01-16 through 2005-01-31

2005-03-02 Thread Max M
hared effort" in the single sub-project, it might very well be on a higher level. -- hilsen/regards Max M, Denmark http://www.mxm.dk/ IT's Mad Science -- http://mail.python.org/mailman/listinfo/python-list

Re: Best way to make a list unique?

2005-03-08 Thread Max M
can be a little simpler: listA = list(Set(listA)) You don't even need to convert it to a list. You can just iterate over the set. >>> la = [1,2,3,4,3,2,3,4,5] >>> from sets import Set >>> sa = Set(la) >>> for itm in sa: ... print itm 1 2 3

Re: split a string with quoted parts into list

2005-03-10 Thread Max M
ted sub entries into a list of strings? In Twisteds protocols/imap4.py module there is a function called parseNestedParens() that can be ripped out of the module. I have used it for another project and put it into this attachment. -- hilsen/regards Max M, Denmark http://www.mxm.dk/ IT's Mad S

Re: csv module and unicode, when or workaround?

2005-03-12 Thread Max M
x27;t support unicode, but you should not have problem importing/exporting encoded strings. I have imported utf-8 encoded string with no trouble. But I might just have been lucky that they are inside the latin-1 range? -- hilsen/regards Max M, Denmark http://www.mxm.dk/ IT's Mad Scien

Re: Why tuple with one item is no tuple

2005-03-15 Thread Max M
Gregor Horvath wrote: thanks are given to all "problem" solved... Personally I add a , after every list/tuple item. Also the last. It also makes copy/pasting code easier. -- hilsen/regards Max M, Denmark http://www.mxm.dk/ IT's Mad Science -- http://mail.python.org/mailman/

IMAP UTF-7, any codec for that anywhere?

2004-12-01 Thread Max M
Convention -- hilsen/regards Max M, Denmark http://www.mxm.dk/ IT's Mad Science -- http://mail.python.org/mailman/listinfo/python-list

Re: IMAP UTF-7, any codec for that anywhere?

2004-12-01 Thread Max M
Brian Quinlan wrote: > Max M wrote: > >> Is there any codec available for handling The special UTF-7 codec for >> IMAP? > Is there something special do you need or is recipe OK? > > >>> u"\u00ff".encode('utf-7') > '+AP8-' A

Re: Need help on program!!!

2004-12-03 Thread Max M
dice1, dice2 = rolldice() roll += 1 if dice1 + dice2 == 7: print 'Too bad, you loose in roll %s' % roll result = None elif (dice1, dice2) == (first1, first2): print 'Congratulations, you win in roll %s' % roll result = None Hopefully h

Re: Need help on program!!!

2004-12-03 Thread Max M
Dan Perl wrote: "Max M" <[EMAIL PROTECTED]> wrote in message Most of us here have been students (or still are) and may sympathize with the OP, but personally I have been also a TA so I have seen the other side and that's where my sympathy lies now. My reply was a joke... M

Re: Psycopg 1.1.17 compiled binaries for windows, postgre 8.0.0-beta4 and python 2.3

2004-12-09 Thread Max M
://initd.org/projects/psycopg1 Postgres runs fine on Windows now in a native version. And pgAdmin is a pretty nice tool. A precompiled psycopg is the missing link. Thanks. I will try it out. -- hilsen/regards Max M, Denmark http://www.mxm.dk/ IT's Mad Science -- http://mail.python.org/ma

Re: Persistent objects

2004-12-12 Thread Max M
app and restart it later, there'd be a way to bring d back into the process and have that Frob instance be there. Have you considdered using the standalone ZODB from Zope? -- hilsen/regards Max M, Denmark http://www.mxm.dk/ IT's Mad Science -- http://mail.python.org/mailman/listinfo/python-list

Re: do you master list comprehensions?

2004-12-13 Thread Max M
u might be more comfortable with: data = [['foo','bar','baz'],['my','your'],['holy','grail']] result = [] for l in data: result += l -- hilsen/regards Max M, Denmark http://www.mxm.dk/ IT's Mad Science -- http://mail.python.org/mailman/listinfo/python-list

Re: do you master list comprehensions?

2004-12-13 Thread Max M
Fredrik Lundh wrote: Max M wrote: I tried funnies like [[w for w in L] for L in data], That is absolutely correct. It's not a funnie at all. well, syntactically correct or not, it doesn't do what he want... Doh! *I* might not be used to list comprehensions then... You are right. Th

Re: Help need with converting Hex string to IEEE format float

2004-12-14 Thread Max M
nd stuff. You should get tons of answers. ## st = '80 00 00 00' import binascii import struct s = ''.join([binascii.a2b_hex(s) for s in st.split()]) v = struct.unpack("f", s)[0] print v ## regards Max M -- hilsen/regards Max M, Denmark http://www.mxm.dk/ IT's Mad Science -- http://mail.python.org/mailman/listinfo/python-list

Re: python re - a not needed

2004-12-16 Thread Max M
ftware/BeautifulSoup/ I will most likely do what you want in 2 or 3 lines of code. -- hilsen/regards Max M, Denmark http://www.mxm.dk/ IT's Mad Science -- http://mail.python.org/mailman/listinfo/python-list

Re: Why are tuples immutable?

2004-12-16 Thread Max M
t the time taken to convert a list into a tuple. -- hilsen/regards Max M, Denmark http://www.mxm.dk/ IT's Mad Science -- http://mail.python.org/mailman/listinfo/python-list

Re: character encoding conversion

2004-12-13 Thread Max M
return st_encoded, encoding except UnicodeError: pass st = 'Test characters æøå ÆØÅ' encodings = ['utf-8', 'latin-1', 'ascii', ] print get_encoded(st, encodings) (u'Test characters \xe6\xf8\xe5 \xc6\xd8\xc5', '

Re: Python To Send Emails Via Outlook Express

2004-12-19 Thread Max M
using those email adresse, or you don't log on with the correct credentials. -- hilsen/regards Max M, Denmark http://www.mxm.dk/ IT's Mad Science -- http://mail.python.org/mailman/listinfo/python-list

Re: Is this a good use for lambda

2004-12-20 Thread Max M
The entity Fredrik Lundh wrote: Isn't it about time you became xml avare, and changed that to: ? -- hilsen/regards Max M, Denmark http://www.mxm.dk/ IT's Mad Science -- http://mail.python.org/mailman/listinfo/python-list

Re: Is this a good use for lambda

2004-12-20 Thread Max M
Steve Holden wrote: Max M wrote: Isn't it about time you became xml avare, and changed that to: Yeah, but give the guy a break, we've all made feeble attempts at humor from time to time. Hey, what's wrong with a little nørd humor... I just found it amusing that somenone like Fred

Re: Python To Send Emails Via Outlook Express

2004-12-20 Thread Max M
to find those than it is to use them as the sender. Most email clients can fetch the settings from other mail clients, so it's been done before. -- hilsen/regards Max M, Denmark http://www.mxm.dk/ IT's Mad Science -- http://mail.python.org/mailman/listinfo/python-list

Re: MIDI library recommendations, please?

2004-12-20 Thread Max M
project which does that on different platforms. But I am not aware how well they work. The best place to ask is probably on the Python Midi list at: http://sourceforge.net/mail/?group_id=113783 -- hilsen/regards Max M, Denmark http://www.mxm.dk/ IT's Mad Science -- http://mail.python.org/ma

Re: Python To Send Emails Via Outlook Express

2004-12-24 Thread Max M
len(RecipWork) # Formulate the recipients MapiRecipDesc_A = MapiRecipDesc * len(RecipWork) rda = MapiRecipDesc_A() for rd, ra in zip(rda, RecipWork): rd.ulReserved = 0 rd.ulRecipClass = MAPI_TO rd.lpszName = None rd.lpszAddress = ra rd.ulEIDSize = 0 rd.lpEntryID = None recip = rda # send the message msg

Re: Python To Send Emails Via Outlook Express

2004-12-25 Thread Max M
Steve Holden wrote: Max M wrote: Lenard Lindstrom wrote: So what is this, some kind of competition? If you really though Lenard's quoting was a sin (since I took your remarks to be sardonic), how much more so was your gratuitous repetition thereof? I thought that showing by example might h

Re: How to create an object instance from a string??

2005-03-20 Thread Max M
Tian wrote: How can I create an instance of an object from a string? For example, I have a class Dog: class Dog: def bark(self): print "Arf!!!" def Factory(class_name): classes = { 'Dog':Dog } return classes[class_name] dog = Factory('Dog&

Re: IMAP4.search by message-id ?

2005-03-29 Thread Max M
ror Why do you need the 'HEADER' Wouldn't this be enough? resp, items = server.search(None, 'Message-id', msgID) I am note shure if the msgId should be quoted. I assume not, as it will allways be an integer. -- hilsen/regards Max M, Denmark http://www.mxm.dk/ IT's Mad Science -- http://mail.python.org/mailman/listinfo/python-list

Re: oddness in string.find(sub,somestring)

2005-03-30 Thread Max M
are you going to fix it? -- hilsen/regards Max M, Denmark http://www.mxm.dk/ IT's Mad Science -- http://mail.python.org/mailman/listinfo/python-list

Re: oddness in string.find(sub,somestring)

2005-03-30 Thread Max M
_string, substring) # note the order searched_string="" print string.find(searched_string, substring) You will not make that error if you use the string method instead. searched_string.find(substring) And you don't have to import anything either.. -- hilsen/regards Max M, Denmar

Re: Generating RTF with Python

2005-03-31 Thread Max M
at this a while ago, which might be a starter. http://pyrtf.sourceforge.net/ -- hilsen/regards Max M, Denmark http://www.mxm.dk/ IT's Mad Science -- http://mail.python.org/mailman/listinfo/python-list

Re: Problem with national characters

2005-03-31 Thread Max M
your strings as unicode, do the transfom, and encode it back as latin1. print repr('før'.decode('latin-1').upper().encode('latin-1')) # 'F\xd8R' print repr('FØR'.decode('latin-1').encode('latin-1')) 'F\xd8R' -- hilsen

Re: Problems extracting attachment from email

2005-04-08 Thread Max M
I see that the last 255 bytes are missing. How is this possible, I receive every last byte from stdin? I don't think its a Python problem. Those methods are used in a lot of places. Your file is most likely not what it is supposed to be. -- hilsen/regards Max M, Denmark http://www.mxm.dk/

Re: doubt regarding Conversion of date into timestamp

2005-04-08 Thread Max M
praba kar wrote: Dear All, I am new to Python I want to know how to change a time into timestamp Is there any specific reason for not using datetime instead of time ? -- hilsen/regards Max M, Denmark http://www.mxm.dk/ IT's Mad Science -- http://mail.python.org/mailman/listinfo/python-list

Re: Can dictionary values access their keys?

2005-04-08 Thread Max M
Matthew Thorley wrote: I am creating an object database to store information about network devices, e.g. switches and routers. Possible usefull pages? http://www.python.org/doc/essays/graphs.html more at: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/119466 -- hilsen/regards Max M

Re: To decode the Subject =?iso-8859-2?Q?=... in email in python

2005-04-20 Thread Max M
ecode such a subject, returning a unicode string? The use would be like human_readable = cool_library.decode_equals(message['Subject']) parts = email.Header.decode_header(header) new_header = email.Header.make_header(parts) human_readable = unicode(new_header) -- hilse

Re: MidiToText : EventDispatcher instance has no attribute 'sysex_events'

2006-01-01 Thread Max M
Try changing "def sysex_event(self, data):" in > ...\midi\EventDispatcher.py to "def sysex_events(self, data):" Or just do a search and replace on the whole package:: search: sysex_events( replace: sysex_event( Apparently I have been inconsistent in my naming. New version at: http://www.mxm.dk/products/public/pythonmidi/download -- hilsen/regards Max M, Denmark http://www.mxm.dk/ IT's Mad Science -- http://mail.python.org/mailman/listinfo/python-list

Re: Are there anybody using python as the script engine for ASP?

2006-01-05 Thread Max M
nPython would be worth trying out, though a bit premature. -- hilsen/regards Max M, Denmark http://www.mxm.dk/ IT's Mad Science -- http://mail.python.org/mailman/listinfo/python-list

Re: Microsoft IronPython?

2006-01-06 Thread Max M
lanuage and make an incompatible version that they could control. As far as I can see C## has that role for them. So I don't see how Python should be in any danger. -- hilsen/regards Max M, Denmark http://www.mxm.dk/ IT's Mad Science -- http://mail.python.org/mailman/listinfo/python-list

Re: Two Classes In Two Files

2006-08-09 Thread Max M
__name__ == "__main__": > x = Two() > x.methodA() > x.methodB() > > When I run the Two.py file, I get the expected output but I'd like to > eliminate the from line in two.py. > -- hilsen/regards Max M, Denmark http://www.mxm.dk/ IT's Mad Science Phone: +45 66 11 84 94 Mobile: +45 29 93 42 96 -- http://mail.python.org/mailman/listinfo/python-list

Re: Memory Management in python 2.5

2006-10-09 Thread Max M
could reuse it again later. From 2.5 onwards it should release most of the unused memory. However it doesn't use less memory. The peak memory usage should be the same as before. So for one-off programs that starts up and runs once, there should not be much gain. -- hilsen/re

Re: OT: Sarcasm and irony

2006-10-10 Thread Max M
"yes, that's what it means" Are you an american? Irony does mean that one says the opposite of what one really means. If you do it for humor its irony, if you do it for mocking it is sarcasm. So now I see... americans really *do* understand irony. -- hilsen/regards Max M, Denmark http://www.mxm.dk/ IT's Mad Science -- http://mail.python.org/mailman/listinfo/python-list

Re: OT: Sarcasm and irony

2006-10-10 Thread Max M
as such and not as sarcasm. -- hilsen/regards Max M, Denmark http://www.mxm.dk/ IT's Mad Science -- http://mail.python.org/mailman/listinfo/python-list

Re: send an email with picture/rich text format in the body

2006-05-29 Thread Max M
y read html messages. In my experience the kind of user that receives emails with html and pictures often prefer it that way. So why bother with the lecture? I cannot remember when I have last received a relevant email that I could not read in text mode. -- hilsen/regards Max M, Denmark http://w

Re: send an email with picture/rich text format in the body

2006-05-29 Thread Max M
Scott David Daniels wrote: > Max M wrote: > >> 90% of users are non-technical users who use standard email readers, >> that can easily read html messages. >> >> In my experience the kind of user that receives emails with html and >> pictures often prefer i

Re: John Bokma harassment

2006-05-30 Thread Max M
ke you should be spending time on MySpace OMG!. I assume that the single l in alright is the courteous misspelling that should allways be in a posting, when correcting other peoples speling? -- hilsen/regards Max M, Denmark http://www.mxm.dk/ IT's Mad Science Phone: +45 66 11 84 94 Mo

Re: Best Python Editor

2006-05-31 Thread Max M
Manoj Kumar P wrote: > Hi, > > Can anyone tell me a good python editor/IDE? > It would be great if you can provide the download link also. pydev on top of eclipse is a nice tool. -- hilsen/regards Max M, Denmark http://www.mxm.dk/ IT's Mad Science Phone: +45 66 11 84 94

Re: Variable name has a typo, but code still works. Why?

2006-05-31 Thread Max M
spelled > in the singular (session). > > Is there some type of name resolution of local variables where Python > makes assumptions? No. You are probably running your script in an ide that keeps an old variable hanging around. Try it from a command promt. -- hilsen/regards Max M,

Re: Python is fun (useless social thread) ;-)

2006-06-19 Thread Max M
ifferent in use than current version. -- hilsen/regards Max M, Denmark http://www.mxm.dk/ IT's Mad Science Phone: +45 66 11 84 94 Mobile: +45 29 93 42 96 -- http://mail.python.org/mailman/listinfo/python-list

Re: Python is fun (useless social thread) ;-)

2006-06-20 Thread Max M
bruno at modulix wrote: > Max M wrote: >> bruno at modulix wrote: >> >>>> Or did you just like what you saw and decided to learn it for fun? >>> >>> Well, I haven't be really impressed the first time - note that it was at >>> the very e

Re: A game idea.

2006-06-27 Thread Max M
ill have to do it yourself. I am not trying to be negative, but I will bet you that every competent programmer on the list has 1+ project that she would love to do, if she just had the time. -- hilsen/regards Max M, Denmark http://www.mxm.dk/ IT's Mad Science Phone: +45 66 11 84 94 M

Re: The lib email parse problem...

2006-08-29 Thread Max M
叮叮当当 wrote: > this is not enough. > > when a part is mulitpart/alternative, i must find out which sub part i > need, not all the subparts. so i must know when the alternative is > ended. Have you tried the email module at all? -- hilsen/regards Max M, Denmark http://www.m

Re: sending emails using python

2006-09-07 Thread Max M
can lead you into so many traps. Especially if you are using international characters in you messages. -- hilsen/regards Max M, Denmark http://www.mxm.dk/ IT's Mad Science Phone: +45 66 11 84 94 Mobile: +45 29 93 42 96 -- http://mail.python.org/mailman/listinfo/python-list

Re: Problems with email.Generator.Generator

2006-09-12 Thread Max M
possible to use a unicode string as a message. The charset passed in set_payload(pl ,charset) is the charset the the string *is* encoded in. Not the charset it *should* be encoded in. -- hilsen/regards Max M, Denmark http://www.mxm.dk/ IT's Mad Science Phone: +45 66 11 84 94 Mobile: +45 29 93 42 96 -- http://mail.python.org/mailman/listinfo/python-list

Re: Problems with email.Generator.Generator

2006-09-12 Thread Max M
Chris Withers wrote: > Max M wrote: >> From the docs: >> >> """ >> The payload is either a string in the case of simple message objects >> or a list of Message objects for MIME container documents (e.g. >> multipart/* and message/rfc822) &g

  1   2   >