Re: Parsing Email Headers

2010-03-12 Thread Thomas Guettler
uot;From") Hi T, wait, this code looks strange. You delete the email if it contains an empty line? I use something like this: message='\n'.join(connection.retr(msg_num)[1]) Your code: emailMessage = email.message_from_string(line) create an email object from only *one* lin

crypto: verify external pkcs7 signature

2010-03-24 Thread Thomas Guettler
.load_pkcs7('secKey.pkcs7') try: print s.verify(p7, File(open(file))) except (M2Crypto.SMIME.PKCS7_Error, M2Crypto.SMIME.SMIME_Error), exc: print '%s failed: %s' % (file, str(exc).strip()) return False return True }}} -- Thomas Guettler, h

Splitting a string

2010-04-02 Thread Thomas Heller
Maybe I'm just lazy, but what is the fastest way to convert a string into a tuple containing character sequences and integer numbers, like this: 'si_pos_99_rep_1_0.ita' -> ('si_pos_', 99, '_rep_', 1, '_', 0, '.ita') Thanks for ideas,

Re: Splitting a string

2010-04-02 Thread Thomas Heller
Patrick Maupin schrieb: > On Apr 2, 6:24 am, Peter Otten <__pete...@web.de> wrote: >> Thomas Heller wrote: >> > Maybe I'm just lazy, but what is the fastest way to convert a string >> > into a tuple containing character sequences and integer numbers, like >

Re: unittests with different parameters

2010-11-22 Thread Richard Thomas
On Nov 22, 11:38 am, Ulrich Eckhardt wrote: > Hi! > > I'm writing tests and I'm wondering how to achieve a few things most > elegantly with Python's unittest module. > > Let's say I have two flags invert X and invert Y. Now, for testing these, I > would write one test for each combination. What I

hashlib in one line

2010-11-29 Thread Thomas Guettler
Hi, I think it would be nice if you could use the hashlib in one line: hashlib.sha256().update('abc').hexdigest() Unfortunately update() returns None. Is there a way to convert a string to the hexdigest of sha256 in one line? Thomas -- Thomas Guettler, http://www.thomas-guet

Re: hashlib in one line

2010-11-29 Thread Thomas Guettler
Thank you, I was blind: See "condensed": http://docs.python.org/library/hashlib.html Stefan Sonnenberg-Carstens wrote: > Am 29.11.2010 14:50, schrieb Thomas Guettler: >> Hi, >> >> I think it would be nice if you could use the hashlib in one line: >> >&g

[Q] get device major/minor number

2010-11-30 Thread Thomas Portmann
Hello all, In a script I would like to extract all device infos from block or character device. The "stat" function gives me most of the infos (mode, timestamp, user and group id, ...), however I did not find how to get the devices major and minor numbers. Of course I could do it by calling an ext

Re: [Q] get device major/minor number

2010-11-30 Thread Thomas Portmann
On Tue, Nov 30, 2010 at 9:18 PM, Dan M wrote: > On Tue, 30 Nov 2010 21:09:14 +0100, Thomas Portmann wrote: >> In the example below, I would like to get the major (8) and minor (0, 1, >> 2) numbers of /dev/sda{,1,2}. How can I get them? > > I think the os.major() and os.mino

select on multiprocessing Listener class

2010-12-07 Thread Thomas Burdick
The multiprocessing module has some wrappers for sockets and while the Client object is selectable the Listener is not, I'm wondering if that could be changed or if there's a way to do it already that I'm not seeing? -Tom -- http://mail.python.org/mailman/listinfo/python-list

Re: How to populate all possible hierarchical clusterings from a set of elements?

2011-01-13 Thread Richard Thomas
On Jan 13, 10:02 am, Alain Ketterlin wrote: > justin writes: > > Suppose I have [1,2,3,4,5], then there are many ways of making > > clustering. > > Among them, I want to pair up terminals until there is only one left > > at the end. > > Are you trying "ascending hierarchical clustering" by any ch

Re: How to populate all possible hierarchical clusterings from a set of elements?

2011-01-13 Thread Richard Thomas
On Jan 13, 3:59 pm, Alain Ketterlin wrote: > Richard Thomas writes: > > On Jan 13, 10:02 am, Alain Ketterlin > >> def clusterings(l): > >>     if len(l) == 1: > >>         print repr(l) > >>     else: > >>         n = len(l) > >>  

FTP problem

2011-01-14 Thread Thomas Philips
nt computers and on two different versions of Python (2.6 and 2.7). I get the same error both times, and have no understanding of what the problem might be. Any assistance would be greatly appreciated. Sincerely Thomas Philips -- http://mail.python.org/mailman/listinfo/python-list

Re: Problems with FTP

2011-01-21 Thread Thomas Jollans
E configuration, or ask the local sysadmin. http://stackoverflow.com/questions/1293518/proxies-in-python-ftp-application It looks like you will have to ftp to the proxy server. Depending on the application, you might be able to use urllib2 instead. Thomas > > I've tried the followin

Re: difference between python and matlab

2011-01-21 Thread Thomas Jollans
On Thursday 20 January 2011, it occurred to lakshmi to exclaim: > Is the programming related to image processing in python is advantageous or > else in MATLAB Tell us what you want to do, and what you know about doing this in Python and in MATLAB, if possible, ask a specific question. Then, someb

Re: return an object of a different class

2011-02-15 Thread Richard Thomas
On Feb 16, 2:23 am, s...@uce.gov wrote: > How can I do something like this in python: > > #!/usr/bin/python3.1 > > class MyNumbers: >    def __init__(self, n): >      self.original_value = n >      if n <= 100: >        self = SmallNumers(self) >      else: >        self = BigNumbers(self) > > clas

Re: Interfaces

2010-04-05 Thread Richard Thomas
On Apr 5, 4:40 pm, Roald de Vries wrote: > Dear all, > > PEP 245 and 246 about interfaces for python are both rejected for   > 'something much better' (GvR in 246's rejection notice). Does anybody   > know what this is? I am *very* curious! > > Kind regards, Roald Given that was in 2001, probably

Re: Generating a rainbow?

2010-04-08 Thread Richard Thomas
On Apr 8, 5:46 pm, Tobiah wrote: > I'm having a difficult time with this.  I want > to display a continuous range of hues using HTML > hex representation (#RRGGBB).  How would I go > about scanning through the hues in order to > make a rainbow? > > Thanks, > > Toby Look at the colorsys module. h

Re: Imports again...

2010-04-09 Thread Thomas Guettler
Hi, please post your traceback. I guess you have a recursive import. This can lead to strange exceptions (for example AttributeError) Thomas Alex Hall wrote: > Hello all, once again: > http://www.gateway2somewhere.com/sw/sw.zip > > The above link is to a project. I am new to us

Re: ctypes: delay conversion from c_char_p to string

2010-04-24 Thread Thomas Heller
can retrive the value via the .value property and deallocate the resources in the destructor for example. -- Thanks, Thomas -- http://mail.python.org/mailman/listinfo/python-list

Python daemonisation with python-daemon

2010-04-30 Thread Thomas Courbon
ectly the daemon (joining children, flushing buffers, closing connections...). If that's relevant, the connection I use is a Listener/Client connection from the standard multiprocessing module. I'm quite neophyte in Unix daemon programming so please forgive me if my question are obvious.

Access class from staticmethod

2010-04-30 Thread Thomas Allen
Is that possible? class A(object): @staticmethod def set_b(x): # A.b = x, without knowing A is "A" pass Thomas -- http://mail.python.org/mailman/listinfo/python-list

Re: Access class from staticmethod

2010-04-30 Thread Thomas Allen
Ah ha, @classmethod. On Apr 30, 3:47 pm, Thomas Allen wrote: > Is that possible? > > class A(object): >   @staticmethod >   def set_b(x): >     # A.b = x, without knowing A is "A" >     pass > > Thomas -- http://mail.python.org/mailman/listinfo/python-list

Re: Windows - select.select, timeout and KeyboardInterrupt

2010-05-06 Thread Thomas Heller
Paul Moore schrieb: >>From a quick experiment, it seems that select.select with a timeout > doesn't react to a keyboard interrupt until the timeout expires. > Specifically, if I do > > s = socket.socket() > select.select([s], [], [], 30) > > and then press Ctrl-C, Python waits for the 30 seconds

No module named server

2010-05-07 Thread Thomas Lehmann
Python 3.1.1 (r311:74483, Aug 17 2009, 17:02:12) [MSC v.1500 32 bit (Intel)] on win32 Script: from http.server import HTTPServer, CGIHTTPRequestHandler Result: Traceback (most recent call last): File "http.py", line 1, in from http.server import HTTPServer, CGIHTTPRequestHandler File "F:

Re: No module named server

2010-05-07 Thread Thomas Lehmann
> Python 3.1.1 (r311:74483, Aug 17 2009, 17:02:12) [MSC v.1500 32 bit Also after installing Python 3.1.2 the problem is still there. -- http://mail.python.org/mailman/listinfo/python-list

Re: No module named server

2010-05-07 Thread Thomas Lehmann
On 7 Mai, 10:02, Thomas Lehmann wrote: > > Python 3.1.1 (r311:74483, Aug 17 2009, 17:02:12) [MSC v.1500 32 bit > > Also after installing Python 3.1.2 the problem is still there. I know the problem. Reading a book about a simple cgi web server the descriptions says to use httpd.py

Re: function that counts...

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

intervall of about 1 second for xmlrpc calls?

2010-05-20 Thread Thomas Lehmann
Hi, I'm wondering about the behavior. Running this example - it looks like - that each rpc call is triggered in a visible interval (about one second). What's wrong? Thomas APPENDIX: import threading from xmlrpc.server import SimpleXMLRPCServer import xmlrpc.client clas

Re: intervall of about 1 second for xmlrpc calls?

2010-05-20 Thread Thomas Lehmann
> What's wrong? > Obviously there's a problem with "localhost". When using the IP of my machine everything is working fast. -- http://mail.python.org/mailman/listinfo/python-list

Re: Problem with an huge dictionary

2010-05-20 Thread Thomas Lehmann
> > The question is: > Is there a limit on the number of entries a dictionary can have i > jython? > > I wrote a little app where my data is stored in a huge dictionary > (11746 entries) generated with a python script. > When I try to import the dictionary, jython complains with the > following mes

Re: map is useless!

2010-06-06 Thread Thomas Jollans
On 06/06/2010 05:16 PM, rantingrick wrote: > So can anyone explain this poor excuse for a map function? Maybe GVR > should have taken it out in 3.0? *scratches head* > > Speaking of Py3k: map no longer builds lists. What once was map is no more, what once was itertools.imap is now map. Sometim

Re: Drop Table w/ MySQLdb?

2010-06-06 Thread Thomas Jollans
On 06/06/2010 05:07 PM, Victor Subervi wrote: > Hi; > I tried this: > > cursor.execute('drop table tmp%s', tmpTable) It looks like you're trying to %s-insert *part* of the table name. I doubt any DB interface allows that. cursor.execute('drop table %s', table_name) might work, otherwise, you'l

Re: map is useless!

2010-06-06 Thread Richard Thomas
Python's map has the useful feature that nobody is in any doubt about what it does. I don't know much about Ruby I have to say but looking at that piece of syntax you gave I had no idea how to interpret it. Anyway, I looked it up. Calling an method on each of a collection of objects is best accomp

Re: Reading file bit by bit

2010-06-07 Thread Richard Thomas
On Jun 7, 10:17 am, Peter Otten <__pete...@web.de> wrote: > Alfred Bovin wrote: > > I'm working on something where I need to read a (binary) file bit by bit > > and do something depending on whether the bit is 0 or 1. > > > Any help on doing the actual file reading is appreciated. > > The logical u

Re: vector addition

2010-06-07 Thread Thomas Jollans
On 06/07/2010 07:45 PM, Dan Stromberg wrote: > > Call me strange, but I regard this as a good place to use a functional > style - IE, to use reduce, and furthermore I regard this as a good > example of why reduce is useful for more than just summing numbers: > > #!/disc/gx/sdfw/dans/python26/bin/py

Re: Which objects are expanded by double-star ** operator?

2010-06-07 Thread Thomas Jollans
On 06/07/2010 10:17 PM, kkumer wrote: > I have to merge two dictionaries into one, and in > a "shallow" way: changing items should be possible > by operating either on two parents or on a > new dictionary. I am open to suggestions how > to do this (values are always numbers, BTW), but > I tried to

Re: PyQt signals/slots dialogs question

2010-06-07 Thread Thomas Jollans
On 06/07/2010 08:21 PM, AlienBaby wrote: > On Jun 7, 5:21 pm, AlienBaby wrote: > >> My real aim here is to learn pyqt, so I would rather not the the >> QWizard process until I understand myself whats going on behind the >> scenes. >> > Perhaps I posted to early, but a little more perserver

Re: python2.5 x python2.6 in interactive mode

2010-06-07 Thread Thomas Jollans
On 06/07/2010 01:43 PM, Alan wrote: > Hi there, > > I have a code with a 'exit()' at the end. We run it usually as: > > python2.5 -i code.py > > and if everything is fine, the 'exit()' is called and there's no > interactive terminal. You could instead do something like this: try: # ... except:

Re: UnboundLocalError: local variable referenced before assignment

2010-06-08 Thread Richard Thomas
On Jun 8, 9:03 am, ch1zra wrote: > I have following code : > > import os, time, re, pyodbc, Image, sys > from datetime import datetime, date, time > from reportlab.lib.pagesizes import A4 > from reportlab.lib.units import cm > from reportlab.pdfgen import canvas > from reportlab.pdfbase import pdf

Re: optparse: best way

2010-06-08 Thread Thomas Jollans
by the way), I'm using the example because I know it fairly well, lets you use either "-o exe" or "--output-format=exe" (GNU-style long option) here. So I'd recommend you either live with "-o exe" and the like, or you'll probably have to write your own

Re: python2.5 x python2.6 in interactive mode

2010-06-08 Thread Thomas Jollans
ication > from within the code. > > Is it possible? > > Thanks, > > Alan > > On Tue, Jun 8, 2010 at 10:20, Alan <mailto:alanwil...@gmail.com>> wrote: > > Thanks Thomas, > > I will give a look at module code. > > Thanks, > > Ala

Re: Question about NNTPLib

2010-06-08 Thread Thomas Jollans
y3k/library/nntplib.html#nntplib.NNTP.xover and then maybe write something like this: resp, items = server.xover(first, last) subjects = (info[1] for info in items) for s in subjects: print (s) Have fun, Thomas PS: my untested code here was sketched up with Python 3.x in mind. You might have t

Re: Syntax problem - cannot solve it by myself

2010-06-08 Thread Thomas Jollans
On 06/09/2010 12:04 AM, Deadly Dirk wrote: > On Tue, 08 Jun 2010 21:44:18 +, Deadly Dirk wrote: > > >> I am a total beginner with Python. I am reading a book ("The Quick >> Python Book", 2nd edition, by Vernon Ceder) which tells me that print >> function takes end="" argument not to print ne

Re: Python way to printk?

2010-06-09 Thread Thomas Jollans
On 06/09/2010 11:40 PM, J wrote: > Does anyone know of a way, or have a recipe, to do a linux printk > equivalent in Python? > > I've been googling for a while and not finding anything useful. > > The nutshell version of this is that I need to write a routine for a > test tool I'm working on that

Re: Cross-platform detection of exceptions raised during file access via os, shutil, codecs, etc.

2010-06-09 Thread Thomas Jollans
arts of the interpreter that call into Windows or VMS APIs, "for historical reasons". There are probably functions with the same implementation on Windows and UNIX that would then raise an OSError. I doubt it's ever, to the programmer, a useful destinction, but it's not a problem either: just catch OSError instead. -- Thomas > > Thank you, > Malcolm > > [1] http://docs.python.org/library/exceptions.html > > -- http://mail.python.org/mailman/listinfo/python-list

Re: historic grail python browser "semi-recovered"

2010-06-09 Thread Thomas Jollans
On 06/09/2010 11:29 PM, lkcl wrote: > um, please don't ask me why but i found grail, the python-based web > browser, and have managed to hack it into submission sufficiently to > view e.g. http://www.google.co.uk. out of sheer apathy i happened to > have python2.4 still installed which was the onl

Re: Another nntplib Question

2010-06-09 Thread Thomas Jollans
On 06/10/2010 12:56 AM, Anthony Papillion wrote: > Hello Everyone, > > Thanks to help from this group, my statistical project is going very > well and I'm learning a LOT about Python as I go. I'm absolutely > falling in love with this language and I'm now thinking about using it > for nearly all m

Re: tkinter doubt

2010-06-10 Thread Thomas Jollans
On 06/10/2010 08:50 AM, madhuri vio wrote: > # File: hello2.py > > from Tkinter import * > > class App: > > def __init__(self, master): > > frame = Frame(master) > frame.pack() > > self.button = Button(frame, text="QUIT", fg="red", command=frame.quit) > > s

Re: How to read source code of python?

2010-06-10 Thread Thomas Jollans
uld be? There is excellent documentation of the language and standard library at http://docs.python.org/ . Otherwise, just download the Python source code! You know it's free. I think it's pretty well organised, though I haven't worked with it a lot yet myself. Just poke around!

Re: Py++, boost and python type mismatch error

2010-06-10 Thread Thomas Jollans
On 06/10/2010 05:15 PM, Murrgon wrote: > I have a simple C++ library (from a dll) I am attempting to make > accessible through bindings to python. I used Py++ to generate some > boost code for the library that I compiled into a pyd. I can import the > pyd no problem into python, but I can't seem

Re: What's the difference?

2010-06-10 Thread Thomas Jollans
On 06/10/2010 10:47 PM, Anthony Papillion wrote: > Someone helped me with some code yesterday and I'm trying to > understand it. The way they wrote it was > > subjects = (info[2] for info in items) This is a generator expression, and it creates a generator object. If you loop over it (subjects),

Re: __getattribute__ and methods proxying

2010-06-12 Thread Thomas Jollans
On 06/12/2010 09:59 PM, Giampaolo Rodolà wrote: > 2010/6/12 David Zaslavsky : >> Hi, >> >> The problem is that when you make this call: >>> proc.cmdline() >> there are really two steps involved. First you are accessing proc.cmdline, >> then you are calling it. You could think of it as this: >> fun

Re: simple chat server

2010-06-12 Thread Thomas Jollans
On 06/11/2010 12:26 AM, Burakk wrote: > Hi, > > I am using ubuntu lucid and i have started to learn python(vrs 3.1). I > am trying to make a tutorial code(see below) work but when i run the > code, open a terminal window and connect as client with telnet and > type somethings and hit enter, give m

Re: Community (*sigh*)

2010-06-13 Thread Thomas Jollans
t's really, really good, and universally useful, it might actually end up in the stdlib. For example, the standard unittest module which we all know and love was an independent package once upon a time! Also, I'm sick of reading "a modest proposal" in hundreds of subject lines. -- T

Re: Mark built-in module as deprecated

2010-06-13 Thread Thomas Jollans
On 06/13/2010 03:54 PM, moerchendiser2k3 wrote: > Hi, > > can anyone give me a hint how to mark a built-in module as deprecated? > So mark via warnings... I create a module with Py_InitModule4. How are modules ever marked as deprecated? I think all there is to it is issuing a DeprecationWarning..

efficiently create and fill array.array from C code?

2010-06-13 Thread Thomas Jollans
to its own buffer. I'd much rather create an array of a certain size, get a write buffer, and fill it directly -- is that possible? I expect that numpy allows this, but I don't really want to depend on numpy, especially as they haven't released a py3k version yet. -- Thomas -

Re: Mark built-in module as deprecated

2010-06-14 Thread Thomas Jollans
On 06/14/2010 02:30 AM, moerchendiser2k3 wrote: > PyErr_WarnEx(PyExc_DeprecationWarning, "foo deprecated. use fuzz", > 1); > > But where can I write this? With Py_InitModule4 I can just > pass a list of functions but no real execution part which > is executed when a module is imported. This is Py

Re: efficiently create and fill array.array from C code?

2010-06-14 Thread Thomas Jollans
On 06/14/2010 01:18 PM, Hrvoje Niksic wrote: > Thomas Jollans writes: > >> 1. allocate a buffer of a certain size >> 2. fill it >> 3. return it as an array. > > The fastest and more robust approach (I'm aware of) is to use the > array.array('

Re: getting up arrow in terminal to scroll thought history of python commands

2010-06-14 Thread Thomas Jollans
On 06/14/2010 02:37 PM, Vincent Davis wrote: > On Sun, Jun 13, 2010 at 6:24 PM, Irmen de Jong > wrote: >> On 14-6-2010 1:19, Vincent Davis wrote: >>> >>> I just installed 2.6 and 3.1 from current maintenance source on Mac >>> OSx. When I am running as an interactive terminal session the up arrow

Re: biopython

2010-06-14 Thread Thomas Jollans
On 06/14/2010 02:59 PM, madhuri vio wrote: > i cudnt run this!! Take a deep breath, and read the error message. It's very informative, and tells you exactly what the problem is, and how to fix it, if you'd just try to understand it. It would be much appreciated if you had a look at http://www

Re: File descriptor to file object

2010-06-14 Thread Thomas Jollans
ns.html#open Also, it's probably better to just use a tempfile.TemporaryFile or tempfile.NamedTemporaryFile instead of directly using mkstemp. -- Thomas -- http://mail.python.org/mailman/listinfo/python-list

Re: getting up arrow in terminal to scroll thought history of python commands

2010-06-14 Thread Thomas Jollans
On 06/14/2010 03:09 PM, Vincent Davis wrote: > On Mon, Jun 14, 2010 at 6:49 AM, Thomas Jollans wrote: >> On 06/14/2010 02:37 PM, Vincent Davis wrote: >>> On Sun, Jun 13, 2010 at 6:24 PM, Irmen de Jong >>> wrote: >>>> On 14-6-2010 1:19, Vincent Davis wrot

Re: getting up arrow in terminal to scroll thought history of python commands

2010-06-14 Thread Thomas Jollans
>>> Anyway, make sure readline is installed, and then recompile Python. >> >> So I should run >> ./configure >> make install >> again? >> Will this overwrite other py packages I have installed? >> >> Vincent >> > > That should be > ./configure > make > make install > > You missed a rather importan

Re: biopython

2010-06-14 Thread Thomas Jollans
On 06/14/2010 05:45 PM, madhuri vio wrote: > > i am still waiting for some help. WHAT?! Your behaviour on this list is making me really, really angry. We are not a tech support company. You are not paying for the privilege of sending your mail here. However, Sir, you are acting as if you were

Re: Convert .doc to .pdf

2010-06-14 Thread Thomas Jollans
are a few tools that you could hook into - "wv" (for word view) springs to mind. -- Thomas -- http://mail.python.org/mailman/listinfo/python-list

Re: setprocname

2010-06-14 Thread Thomas Jollans
ction called "setprocname". There is no "setprocname" manual page installed on my system, which suggests to me that there is no such function, at least not in the GNU libc. I may be wrong. What makes you expect the existence of this function, and on which platform? -- Thomas -- http://

Re: a +b ?

2010-06-14 Thread Thomas Jollans
On 06/14/2010 09:15 AM, Steven D'Aprano wrote: > On Mon, 14 Jun 2010 12:24:59 +1000, Ben Finney wrote: > >> With ‘reduce’ gone in Python 3 [0] > ... >> [0] http://docs.python.org/py3k/library/functions.html> > > > It's not gone, it's just resting. It's pinin' for the fjords. (sorry ^^) > >

Re: efficiently create and fill array.array from C code?

2010-06-14 Thread Thomas Jollans
On 06/14/2010 09:47 PM, Hrvoje Niksic wrote: > Thomas Jollans writes: > >> On 06/14/2010 01:18 PM, Hrvoje Niksic wrote: >>> Thomas Jollans writes: >>> >>>> 1. allocate a buffer of a certain size >>>> 2. fill it >>>> 3. return

Re: lambdas

2010-06-14 Thread Thomas Jollans
return super(Status, self).__getattribute__(name) This doesn't use properties (why should it?) and proposes a different format for the definitions: a dict instead of a sequence of tuples. dict([(a,b), (c,d)]) == {a: b, c: d}, of course, so that's no problem. Have fun, Thomas -- http://mail.python.org/mailman/listinfo/python-list

Re: Mark built-in module as deprecated

2010-06-14 Thread Thomas Jollans
fic code... You could issue a warning on each and every method call in your module, so that when it's used, the user gets warned. Then you could cache whether a warning has been issued already in a global static variable or in module state to be able to only warn once. Thomas -- http://mail.python.org/mailman/listinfo/python-list

Re: Linking to a Python static library.

2010-06-15 Thread Thomas Jollans
nterpreter in a program linked with -lpython, check the Extending/Embedding section on docs.python.org If you run into any problems along the way, don't hesitate to ask! Thomas -- http://mail.python.org/mailman/listinfo/python-list

Re: Archiving emails in Gmail

2010-06-15 Thread Thomas Jollans
thing you did in Thunderbird, WLM, Sylpheed, Mail.app, or whatever you're using. Have fun, Thomas -- http://mail.python.org/mailman/listinfo/python-list

Re: Python Library Win7 -64 Bit

2010-06-15 Thread Thomas Jollans
ython symbols being undefined. My guess would be that you're compiling for the wrong architecture. Does your mingw compiler produce 64-bit binaries? (the "32" in "mingw32" would suggest otherwise) Debian GNU/Linux has mingw-w64 package, I'd expect there to be a native

Re: Different byte-code in same major version (2.6.x)?

2010-06-15 Thread Thomas Jollans
On 06/15/2010 02:54 PM, Hartmut Goebel wrote: > Hi, > > I'm facing a curious problem: 2.6, 2.6.1 and 2.6.4 are generating > different byte-code for the same source. I can not find the reason for. > > As you may know, I'm providing the 'decompyle' service as > www.crazy-comnpilers.com. This servic

Introducing - Pyaudiogen

2010-06-15 Thread Thomas Jollans
while True: yield (wavetable,) Suggestions welcomed! -- Thomas [1] http://bitbucket.org/jollybox/pyaudiogen> -- http://mail.python.org/mailman/listinfo/python-list

Re: Can code objects outlive the interpreter that created them?

2010-06-15 Thread Thomas Jollans
ot worth the hassle. If using a module as I suggested above isn't an option for some obscure reason, you can always marshal (or pickle) the code -- then it can certainly outlive the interpreter. Thomas -- http://mail.python.org/mailman/listinfo/python-list

Re: Python Tkinter Linux Repair Question/ Python TCP Socket Example

2010-06-15 Thread Thomas Jollans
plit up Python, so that the interpreter package doesn't depend on Tk and X11 being installed. Debian GNU/Linux has a "python-tk" package. I'm sure there is an equivalent package in RHEL. You'll just have to find, it, and install. -- Thomas > > I tried reinstall the entire p

Re: Why I have to do a deepcopy to the argument?

2010-06-16 Thread Thomas Jollans
deepcopy(embedded_obj) > else: > d2[character] = d2.get(character, deepcopy(embedded_obj)) > d2[character][0] += 1 If you don't copy embedded_obj here, you just insert a reference to the same object into the tree at different points. so you insert embedded_obj, iterate one level further into the structure, and insert the exact same embedded_obj, into itself! That's what the [...] and {...} in the output above mean - it's returning cyclic structures. Another example of a cyclic structure: >>> L = list(range(5)) >>> L.append(L) >>> L [0, 1, 2, 3, 4, [...]] >>> Obviously, it goes on for ever and ever, so Python can't print it properly, without the ... -- Thomas -- http://mail.python.org/mailman/listinfo/python-list

Re: Jewish Pirates of the Caribbean

2010-06-16 Thread Thomas Jollans
On 06/16/2010 11:25 AM, nanothermite911fbibustards wrote: > I rcvd appreciative and supporting replies from many of you. Yeah, right. -- http://mail.python.org/mailman/listinfo/python-list

Re: Advanced Dictionary

2010-06-16 Thread Thomas Lehmann
> > class AutoValueDict(dict): >     def __makeitem__(self, key): >         return self.setdefault(key, {}) > >     def __getitem__(self, key): >         return self.get(key, self.__makeitem__(key)) > > I would like to have a dictionary which ensures dictionaries as values > except when I'm assigni

Advanced Dictionary

2010-06-16 Thread Thomas Lehmann
, self.__makeitem__(key)) I would like to have a dictionary which ensures dictionaries as values except when I'm assigning another: dict["abc"]["xyz"]["123"]["456"] = 123 How can I do this without many "if" and "else"? best regards Thomas -- http://mail.python.org/mailman/listinfo/python-list

Re: Coroutines: unexpected behaviour

2010-06-16 Thread Thomas Jollans
On 06/16/2010 02:03 PM, Jérôme Mainka wrote: > Hello, > > I try to experiment with coroutines and I don't understand why this > snippet doesn't work as expected... In python 2.5 and python 2.6 I get > the following output: > > 0 > Exception exceptions.TypeError: "'NoneType' object is not callable

Re: Possible to make subprocess.Popen jobs run serially rather than in parallel?

2010-06-16 Thread Thomas Jollans
On 06/16/2010 04:04 PM, Chris Seberino wrote: > On Jun 15, 2:03 pm, Stephen Hansen wrote: > >> Just call "process.wait()" after you call process = subprocess.Popen(...) > > I may have not been clear. > I *don't* want web app to block on Popen.wait. > I *do* want the Popen process to run in t

Re: Coroutines: unexpected behaviour

2010-06-16 Thread Thomas Jollans
the locals, when the function exits. The module gets destroyed afterwards. What should you do to fix it then? If you really want to keep the except GeneratorExit: approach, make sure you exit it manually. Though really, you should do something like p.send(None) at the end, and check for that in the generator: recieving None would mean "we're done here, do post processing!" -- Thomas -- http://mail.python.org/mailman/listinfo/python-list

Re: Installing Python 3.1.2 from source, how do you resolve the sqlite3-dev dependency?

2010-06-16 Thread Thomas Jollans
if you ever upgrade the system to a newer ubuntu release. * get the source package and build new packages from that. You'll need to install build-essential and find a good howto somewhere. Thomas -- http://mail.python.org/mailman/listinfo/python-list

Re: How to set up this usenet discussion?

2010-06-16 Thread Thomas Jollans
be you'll find one that has comp.lang.python Though, really, why not use the mailing list? Thomas -- http://mail.python.org/mailman/listinfo/python-list

Re: Different byte-code in same major version (2.6.x)?

2010-06-16 Thread Thomas Jollans
On 06/16/2010 10:36 PM, Hartmut Goebel wrote: > Am 15.06.2010 20:43, schrieb Paul Rubin: >> Hartmut Goebel writes: >>> I'm facing a curious problem: 2.6, 2.6.1 and 2.6.4 are generating >>> different byte-code for the same source. I can not find the reason for. >> >> Why should they generate the sa

Re: Writing to open subprocess pipes.

2010-06-16 Thread Thomas Jollans
On 06/16/2010 10:29 PM, Brandon McGinty wrote: > All, > I have researched this both in the python documentation, and via google. > Neither subprocess nor os.popen* will do what I need. > First, I would instanshiate an ongoing shell, that would remain active > throughout the life of the socket conne

Re: exceptions and unicode

2010-06-16 Thread Thomas Jollans
t; Note that the exceptions may be anything (I just used IOError > as an example) and are generated in bowels of an API that I > can't/won't mess with. Yeah, well, you'd have to special-case every single exception type that gets unicode arguments, as they probably all treat them in the same ungrateful way. Thomas -- http://mail.python.org/mailman/listinfo/python-list

Decode II (more complex)

2010-06-21 Thread Thomas Lehmann
sm but very probably I do not understand how the decode/encode functionality is working. Can somebody help me to get out of that problem? Thanks in advance Thomas -- http://mail.python.org/mailman/listinfo/python-list

Re: deduping

2010-06-21 Thread Thomas Lehmann
> universe={} > for line in outf: >     if line.split(',')[1].strip() in universe.keys(): >         a=1 >     else: >         if line.split(',')[1].strip() in done_.keys(): >             a=1 >         else: >             universe[line.split(',')[1].strip()]=0 > I can not say too much because I don

Re: Decode II (more complex)

2010-06-21 Thread Thomas Lehmann
> Your email(s) get send as 7 bit (ASCII). Email them as utf-8 and I guess > your problem is solved. > > How do you email the notifications? > I was copying partly the logic from http://code.activestate.com/recipes/473810 Changing to buffer.decode("utf-8", 'replace') where I'm reading the file a

Re: Where is the help function defined?

2010-06-21 Thread Thomas Jollans
;>> type(help) >>> help is not a function, it's an instance of site._Helper. It just "feels" like a function by being callable. You could create your own "help" callable simply by using the _Helper contructor: >>> import site >>> help2 = site._Helper() >>> -- Thomas -- http://mail.python.org/mailman/listinfo/python-list

Re: Generator (re-)definition within a loop

2010-06-21 Thread Thomas Jollans
or x in oldresult(): ... With the second option, Python takes "result" and saves it in the definition of the new "result". -- Thomas -- http://mail.python.org/mailman/listinfo/python-list

Re: process cannot access the file because it is being used by other process

2010-06-21 Thread Thomas Jollans
message, it should have been easy to figure out that there's something wrong with your variable scopes. -- Thomas -- http://mail.python.org/mailman/listinfo/python-list

Re: What is the difference between 'type' and 'class'?

2010-06-21 Thread Thomas Jollans
that they are at least according > to some webpages that I read. But I'm not completely sure. Could you > let me know in case my impress is wrong? > They're the same. * -- Thomas * In versions prior to 3.0, this is not 100% true. In versions prior to 2.0, this is not true

Re: Should I Learn Python or Ruby next?

2010-06-22 Thread Thomas Jollans
ou're Dutch. Now is better than never. Although never is often better than *right* now. If the implementation is hard to explain, it's a bad idea. If the implementation is easy to explain, it may be a good idea. Namespaces are one honking great idea -- let's do more of those!

Re: Uses of a deprecated module 'string'

2010-06-22 Thread Thomas Jollans
On 06/22/2010 11:11 PM, Steven Howe wrote: > Hi, I'm trying to import 'letters' from the string module. > I get the following message: > > Uses of a deprecated module 'string' > > I realize the functionality of 'string' is now in the _builtin_. But are > the > constants. If so, what are they

Re: Should I Learn Python or Ruby next?

2010-06-22 Thread Thomas Jollans
On 06/23/2010 01:30 AM, Stephen Hansen wrote: > On 6/22/10 4:09 PM, rantingrick wrote: >> ...After reading these comments i reminisce back to a time when a good >> friend of this community "r" said basically the same things but was >> lynched for them. Hmm? Has the community changed? Or is it that

<    23   24   25   26   27   28   29   30   31   32   >