Embedded python

2005-08-04 Thread nico
Hi, Does anyone have embedded a python interpreter on a proprietary hardware ? I have a home made hardware running a home made OS. C is used as programming language. I'd like to add a python interpreter to my system. Any guidelines ? Nicolas -- http://mail.python.org/mailman/listinfo/python-lis

Re: Embedded python

2005-08-04 Thread nico
Chris Johns a écrit : > nico wrote: > >> >> Does anyone have embedded a python interpreter on a proprietary >> hardware ? > > > Yes, http://www.cybertec.com.au/microcore.htm > >> I have a home made hardware running a home made OS. C is used as >

lambda a plusieurs arguments

2005-05-27 Thread nico
.6)) Traceback (most recent call last): File "", line 1, in ? File "", line 1, in TypeError: unpack non-sequence pourquoi ca ne marche pas ? je ne comprends pas le message d'erreur ! Merci. -- nico -- http://mail.python.org/mailman/listinfo/python-list

Re: lambda a plusieurs arguments

2005-05-28 Thread nico
de diffusions > nationales ... > )) Désolé, je me suis trompé de groupe en postant... :( -- nico -- http://mail.python.org/mailman/listinfo/python-list

Re: lambda a plusieurs arguments

2005-05-28 Thread nico
Jp Calderone wrote: > On Fri, 27 May 2005 19:38:33 +0200, nico <[EMAIL PROTECTED]> wrote: >>Bonjour, >> >>Comment faire une fonction lambda a plusieurs arguments ? >> >>>>> (lambda a:a+1)(2) >>3 >>>>> f=(lambda (a,b):a+b) >

OT: Survey facing design patterns and communication

2005-06-06 Thread Nico
Hello everybody! We are a group of students at "Freie Universitaet Berlin". As part of our computer science studies we are going to do a survey facing the use of design patterns in communication. Examples of design patterns are "Abstract Factory", "Singleton", "Composite", "Iterator" and "Listen

How can I have one element list or tuple?

2007-11-01 Thread nico
The following example returns a string type, but I need a tuple... >>> var = ("Hello") >>> print type(var) I need that for a method parameter. Thx -- http://mail.python.org/mailman/listinfo/python-list

Unicode string formating

2007-11-30 Thread nico
Hi, I need to do a lot of string formating, and I have strings and/or unicode strings and when I do the following: "%s %s" % (u'Salut', 'H\xe4llo'), I get an exception : UnicodeDecodeError: 'ascii' codec can't decode byte 0xe4 in position 1: ordinal not in range(128) How can I insure I don't get a

PIL: The _imaging C module is not installed

2011-05-05 Thread Nico Grubert
maging.so ... 2.) $ python ... >>> import _imaging ...success imported! Any idea what might be wrong? Regards Nico -- http://mail.python.org/mailman/listinfo/python-list

Re: Python-list Digest, Vol 92, Issue 40

2011-05-05 Thread Nico Grubert
lable *** LITTLECMS support not available However, running the selftest still fails: $ python selftest.py *** The _imaging C module is not installed Regards Nico -- http://mail.python.org/mailman/listinfo/python-list

Re: PIL: The _imaging C module is not installed

2011-05-06 Thread Nico Grubert
IP) support available --- FREETYPE2 support available *** LITTLECMS support not available However, running the selftest still fails: $ python selftest.py *** The _imaging C module is not installed Regards Nico -- http://mail.python.org/mailman/listinfo/python-list

Re: PIL: The _imaging C module is not installed

2011-05-08 Thread Nico Grubert
de of /usr/local/bin/pilprint.py to 755 changing mode of /usr/local/bin/pildriver.py to 755 creating /usr/local/lib/python2.4/site-packages/PIL.pth $ python selftest.py *** The _imaging C module is not installed Regards Nico -- http://mail.python.org/mailman/listinfo/python-list

user input string to function

2017-12-25 Thread Nico Vogeli
Hi everybody. First ad foremost, happy Christmas! I want to let the use input a function (like x**2) and parse it after that through code (for my numeric class) import numpy as np import matplotlib.pyplot as plt import scipy.linalg from sympy.abc import o, h import sympy from sympy import symbol

Re: user input string to function

2017-12-25 Thread Nico Vogeli
Am Montag, 25. Dezember 2017 14:51:21 UTC+1 schrieb Chris Angelico: > On Tue, Dec 26, 2017 at 12:36 AM, Nico Vogeli wrote: > > Hi everybody. First ad foremost, happy Christmas! > > Same to you! > > > I want to let the use input a function (like x**2) and parse it afte

Re: user input string to function

2017-12-25 Thread Nico Vogeli
Am Montag, 25. Dezember 2017 15:58:26 UTC+1 schrieb Chris Angelico: > On Tue, Dec 26, 2017 at 1:48 AM, Nico Vogeli wrote: > > Am Montag, 25. Dezember 2017 14:51:21 UTC+1 schrieb Chris Angelico: > >> On Tue, Dec 26, 2017 at 12:36 AM, Nico Vogeli wrote: > >> > H

Re: user input string to function

2017-12-25 Thread Nico Vogeli
Am Montag, 25. Dezember 2017 16:56:19 UTC+1 schrieb Chris Angelico: > On Tue, Dec 26, 2017 at 2:04 AM, Nico Vogeli wrote: > > Am Montag, 25. Dezember 2017 15:58:26 UTC+1 schrieb Chris Angelico: > >> On Tue, Dec 26, 2017 at 1:48 AM, Nico Vogeli wrote: > >> > Am Mont

GUI user input to function

2017-12-28 Thread Nico Vogeli
Hello again I think my question got lost in all the others raised, so here I am again :P So, I tried my best, was looking into the eval and exec function, but still no succsess.. Maybe it helps when I provide the code I want to implement: def newton_verfahren(self): if self.cB_1.

Re: GUI user input to function

2017-12-28 Thread Nico Vogeli
Am Donnerstag, 28. Dezember 2017 12:59:24 UTC+1 schrieb Chris Angelico: > On Thu, Dec 28, 2017 at 8:38 PM, Nico Vogeli wrote: > > Withs test, this return a correct value for the two x functions: > > > > from sympy import symbols > > > > x = symbols('x')

Re: GUI user input to function

2017-12-29 Thread Nico Vogeli
Am Donnerstag, 28. Dezember 2017 14:00:14 UTC+1 schrieb Chris Angelico: > On Thu, Dec 28, 2017 at 11:06 PM, Nico Vogeli wrote: > > Am Donnerstag, 28. Dezember 2017 12:59:24 UTC+1 schrieb Chris Angelico: > >> On Thu, Dec 28, 2017 at 8:38 PM, Nico Vogeli wrote: > >>

cProfile, timed call tree

2018-05-25 Thread Nico Schlömer
not construct the call tree with times from Stats. Is this correct? If not, how to get a timed call tree from Stats? Perhaps that's not the right think to work with? Cheers, Nico -- https://mail.python.org/mailman/listinfo/python-list

Re: cProfile, timed call tree

2018-05-28 Thread Nico Schlömer
Thanks, Dieter, for the concise answer. Cheers, Nico On Sat, May 26, 2018 at 7:42 AM dieter wrote: > Nico Schlömer writes: > > > From what I understand about the Python profilers, the type of > information > > you get from a stats object is > > > > * How

How to use a timer in Python?

2005-09-22 Thread Nico Grubert
x27; in os.listdir('/temp'): # ...wait 10 seconds and then check again if # 'transfer.lock' is in os.listdir('/temp') else: # create 'newfile' Nico -- http://mail.python.org/mailman/listinfo/python-list

Re: How to use a timer in Python?

2005-09-23 Thread Nico Grubert
open(WINDOWS_SHARE + '/myfile', 'w') f.write("test 123") f.close() print "Done!" Nico -- http://mail.python.org/mailman/listinfo/python-list

Re: How to use a timer in Python?

2005-09-23 Thread Nico Grubert
can use it in shell too, eg "mkdir /tmp/lock || > exit 1" in your cronjob. There is no cronjob anymore now. I just need to check if there is a lock file. How would you modify my short program to avoid the situation "Ie someone can get in there after you read the directory but before you create the file."? Nico -- http://mail.python.org/mailman/listinfo/python-list

Question about parsing a string

2005-10-10 Thread Nico Grubert
[/url]' I would like to generate this string: 'http://www.whatever.org";>My link' Any idea how I can do this? Maybe with regular expressions? Thanks in advance, Nico -- http://mail.python.org/mailman/listinfo/python-list

ftplib question - ftp.dir() returns something and ftp.nlst() does not

2005-11-24 Thread Nico Grubert
2:13 member.dat -r--r--r-- 1 ownergroup 115 Nov 24 15:53 status.dat -r--r--r-- 1 ownergroup 339 Nov 24 15:53 debug.txt '226 Transfer complete.' >>> >>> ftp.nlst() [] >>> I thought "ftp.nlst()" would return the list ['member.dat', 'status.dat', 'debug.txt']. Any idea, what is going wrong here? Nico -- http://mail.python.org/mailman/listinfo/python-list

Re: ftplib question - ftp.dir() returns something and ftp.nlst() does not

2005-11-25 Thread Nico Grubert
* '200 PORT command Ok.\r\n' *resp* '200 PORT command Ok.' *cmd* 'NLST' *put* 'NLST\r\n' *get* '150 About to open data connection.\r\n' *resp* '150 About to open data connection.' *retr* '' *get* '226 Transfer complete.\r\n' *resp* '226 Transfer complete.' [] >>> Nico -- http://mail.python.org/mailman/listinfo/python-list

Re: ftplib question - ftp.dir() returns something and ftp.nlst() does not

2005-11-25 Thread Nico Grubert
open data connection.' *retr* '' *get* '226 Transfer complete.\r\n' *resp* '226 Transfer complete.' [] >>> ftp.dir() -r--r--r-- 1 ownergroup 121984 Nov 24 12:13 member.dat -r--r--r-- 1 ownergroup 115 Nov 24 15:53 status.dat -r--r--r-- 1 ownergroup 339 Nov 24 15:53 debug.txt >>> Nico -- http://mail.python.org/mailman/listinfo/python-list

How to ping in Python?

2005-12-05 Thread Nico Grubert
Hi there, I could not find any "ping" Class or Handler in python (2.3.5) to ping a machine. I just need to "ping" a machine to see if its answering. What's the best way to do it? Kind regards, Nico -- http://mail.python.org/mailman/listinfo/python-list

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

2005-02-01 Thread Nico Grubert
this also removes xxx occurancies. Any idea, how to modify this to remove all html tags except xxx? Thanks in advance, Nico -- http://mail.python.org/mailman/listinfo/python-list

How to copy a file from one machine to another machine

2005-09-21 Thread Nico Grubert
would be very helpful. Kind regards and many thanks in advance, Nico -- http://mail.python.org/mailman/listinfo/python-list

Re: How to copy a file from one machine to another machine

2005-09-21 Thread Nico Grubert
; is one of the best python books I have read! Really good work! Nico -- http://mail.python.org/mailman/listinfo/python-list

How to use writelines to append new lines to an existing file

2005-09-22 Thread Nico Grubert
r reading >>> f.read() '456' I supposed to have: >>> f.read() '123\n456\n' Does f = open('/tmp/myfile', 'w') overwrite the existing file or does f.writelines('456') replace the first line in the existing file? Nico -- http://mail.python.org/mailman/listinfo/python-list

String question - find all possible versions of a person's firstname

2006-01-10 Thread Nico Grubert
passing 'Michèle' as parameter to it: 'Michele' 'Michelè' 'Michelé' 'Michelê' 'Michêle' 'Michêlè' 'Michêlé' 'Michêlê' 'Michèle' 'Michèlè' 'Michèlé' 'Michèlê' 'Michéle' 'Michélè' 'Michélé' 'Michélê' Thanks in advance, Nico -- http://mail.python.org/mailman/listinfo/python-list

Re: String question - find all possible versions of a person's firstname

2006-01-10 Thread Nico Grubert
> This sounds like a homework problem. You might try splitting the name > at the e's, check the length of the resulting list and do that many > nested loops. This was my idea too but I am wondering if there are any scripts for tasks like this. Nico -- http://mail.python.org/ma

Re: python-soappy

2006-01-11 Thread Nico Grubert
> can anybody point me to a tutorial, howto or example code of > python-soappy...? google did not have really useful results about... This might be helpful: http://www-128.ibm.com/developerworks/library/ws-pyth5/ http://users.skynet.be/pascalbotte/rcx-ws-doc/python.htm Nico --

How to change the path for python binary?

2006-08-10 Thread Nico Grubert
uot;/usr/local/bin/python" which calls the Python 2.4.3 interpreter. My question now is: What do I have to do in order to get the Python 2.3.5 interpreter each time I enter "python" in the shell? Regards, Nico -- http://mail.python.org/mailman/listinfo/python-list

Convert binary image to JPEG with 72 dpi

2006-10-20 Thread Nico Grubert
n 250 pixels. I'd like to use PIL for this job. Any tips how to do it?Regards,    Nico -- http://mail.python.org/mailman/listinfo/python-list

PIL on Python 2.4 - ImportError: No module named _imagingft

2006-10-31 Thread Nico Grubert
d regards, Nico -- http://mail.python.org/mailman/listinfo/python-list

Re: PIL on Python 2.4 - ImportError: No module named _imagingft [Solved]

2006-10-31 Thread Nico Grubert
> If I try > > >>> import _imagingft > > I get this error: > ImportError: No module named _imagingft > > Did I miss something? Yes, I did. Somehow, there was no "_imagingft.so" in the PIL directory. -- http://mail.python.org/mailman/listinfo/python-list

os.popen3() - how to close cmd window automatically?

2006-05-31 Thread Nico Grubert
window opens and its kept open until I close the application "ExternalApplication.exe". How can I close that black empty window automatically? Thanks in advance, Nico -- http://mail.python.org/mailman/listinfo/python-list

Re: os.popen3() - how to close cmd window automatically?

2006-06-01 Thread Nico Grubert
> replace console=[... by windows=[... in your setup.py Works perfect. Thank you, Rony! -- http://mail.python.org/mailman/listinfo/python-list

Search substring in a string and get index of all occurances

2006-06-21 Thread Nico Grubert
mystring" which might be expensive for large strings? Thanks in advance, Nico -- http://mail.python.org/mailman/listinfo/python-list

Searching a string and extract all occurancies of a substring

2006-08-31 Thread Nico Grubert
this text. /foo/bar/doc From this text I need to get a list with this: ["/www/mydoc1", "/foo/bar/doc"] What's the best way to do this? I'll need to use Python: 2.3.5 Thanks in advance, Nico -- http://mail.python.org/mailman/listinfo/python-list

Re: Searching a string and extract all occurancies of a substring

2006-08-31 Thread Nico Grubert
;"" parser = MyDocParser() parser.feed(content) paths = parser.get_paths() return paths # /end This works as long as there are no other Tags in the content that I parse. Nico -- http://mail.python.org/mailman/listinfo/python-list

Re: Searching a string and extract all occurancies of a substring

2006-08-31 Thread Nico Grubert
> This works as long as there are no other Tags in the content > that I parse. Got it. I forgot to handle the 'attrs' parameter in handle_starttag(). Changed it to: def handle_starttag(self, tag, attrs): if tag == 'parameter': if attrs == [('key', 'infobox_path')]:

Re: Searching a string and extract all occurancies of a substring

2006-08-31 Thread Nico Grubert
> is this XML, or just something that looks a little like XML ? Unfortunately, something that looks a little XML so I can't use a XML parser. But the HTML parser does the job. -- http://mail.python.org/mailman/listinfo/python-list

Installing Python on a 64-Bit OS

2006-09-19 Thread Nico Grubert
tgz ? Is there anything special I have to care about or is installing Python on a 64 Bit OS just as easy as installing it on a 32-Bit OS? Regards, Nico -- http://mail.python.org/mailman/listinfo/python-list

Re: Installing Python on a 64-Bit OS

2006-09-21 Thread Nico Grubert
equires > Python 2.4.2 so I'll installed Python 2.4.3. and I am trying to get it running. Thanks for the tips. Nico -- http://mail.python.org/mailman/listinfo/python-list

ldapsearch example in python-ldap?

2006-11-23 Thread Nico Grubert
Hi there, on a linux machine I am running this ldapsearch from the command line: ldapsearch -x -h myldaphost.mydomain.com \ -D "CN=ldapuser,CN=Users,DC=mydomain,DC=com" -w "secret" \ -b "CN=ANYCOMPUTER,CN=Computers,DC=mydomain,DC=com" How can I do this with p

Python's email module - problem with umlauts in some email clients

2006-12-08 Thread Nico Grubert
n'] = '1.0' mainMsg['Content-type'] = 'text/plain; charset=utf-8' mainMsg['Content-transfer-encoding'] = '8bit' # 'quoted-printable' does not work either # mainMsg['Content-Transfer-Encoding'] = 'quoted-printable' s = SMTP(host) s.sendmail(mFrom, [mTo], mainMsg.as_string()) s.close() #-- Regards, Nico -- http://mail.python.org/mailman/listinfo/python-list

Splitting a string

2006-02-13 Thread Nico Grubert
e', 'Blue, T.', 'Back', 'Red', 'Green'] Any idea, how I can split a string where 'and', 'or', 'and not' occurs? Thank you very much in advance, Nico -- http://mail.python.org/mailman/listinfo/python-list

Re: Splitting a string

2006-02-14 Thread Nico Grubert
> re.split("(?i)\s*(and not|and|or)\s*", s) Thanks, Frederik for the step by step howto! And also thanks to you, Dylan. re.split("(?i)\s*(and not|and|or)\s*", s) is almost right. I changed it to: words = re.split("(?i)\s*( and not | and | or )\s*", s) in order to handle words containing "or"

Problems with threading in embedded Python

2007-08-17 Thread Nico Blodow
i will post more :) (basically I modified the run_func.cc file from the docs, added PyEval_InitThreads() and monkeyed around with GIL and Acquire/ReleaseLock, but so far i had no luck :) Cheers, Nico -- http://mail.python.org/mailman/listinfo/python-list

How to use unix_md5_crypt from Perl in Python?

2007-03-22 Thread Nico Grubert
### What do I have to do in Python to create the crypted password 'roK20XGbWEsSM' by using '[EMAIL PROTECTED]' for username and 'root' for password? I tried: >>> username = '[EMAIL PROTECTED]' >>> password = 'root' >>> import crypt >>> crypt.crypt(username, password) 'roowueH.vq6VM' >>> This creates 'roowueH.vq6VM' but not 'roK20XGbWEsSM'. :-( Thanks in advance, Nico -- http://mail.python.org/mailman/listinfo/python-list

Find & Replace hyperlinks in a string

2007-11-26 Thread Nico Grubert
way to do this if I have a few hundret strings to check? Thanks in advance, Nico -- http://mail.python.org/mailman/listinfo/python-list

Sorting a list of dictionaries by dictionary key

2006-05-03 Thread Nico Grubert
', 'from_datetime': DateTime('2006/03/10 12:45:00 GMT+2')}, {'Title': 'DEF', 'from_datetime': DateTime('2006/04/18 12:45:00 GMT+2')}, {'Title': 'ABC', 'from_datetime': DateTime('2006/04/25 12:45:00 GMT+2')}] Any idea how I can sort this list? Thank you very much in advance, Nico -- http://mail.python.org/mailman/listinfo/python-list

Re: Sorting a list of dictionaries by dictionary key

2006-05-03 Thread Nico Grubert
> assuming that DateTime returns something that compares correctly, you can > do something like: > > def sortkey(item): > return item.get("from_datetime") > > data.sort(key=sortkey) > > (assuming Python 2.4 or later) Thank you very much, Frederik. Unfortunately, I can only use P

Re: Zope Guru...

2006-05-04 Thread Nico Grubert
ther existing Zope based application for document management including workflow is "Plone". http://www.plone.org If you plan to start using Zope 3, you might want to take a look at http://www.zope.org/Wikis/DevSite/Projects/ComponentArchitecture/Zope3Workflow Regards, Nico -- http://mail.python.org/mailman/listinfo/python-list

How to open https Site and pass request?

2006-05-23 Thread Nico Grubert
t;/usr/local/lib/python2.3/urllib2.py", line 306, in _call_chain result = func(*args) File "/usr/local/lib/python2.3/urllib2.py", line 914, in unknown_open raise URLError('unknown url type: %s' % type) urllib2.URLError: Any idea, what I did wrong? Regards, Nico -- http://mail.python.org/mailman/listinfo/python-list

Re: How to open https Site and pass request?

2006-05-23 Thread Nico Grubert
lib2.URLError: To answer my question myself: My python installation does not have SSL support (from socket import ssl failed). I tested the same code on another machine and it's working. However, I am wondering how I can additionally enable SSL support for my python installation ? Regards, Nico -- http://mail.python.org/mailman/listinfo/python-list

Re: How to open https Site and pass request?

2006-05-24 Thread Nico Grubert
our reply. I use Linux and installed the package "python-openssl" which allows me to import the module "OpenSSL" (import OpenSSL) but I think installing this package has nothing to do with the SSL support of my python installation. Is that true? Regards, Nico -- http://mail.python.org/mailman/listinfo/python-list

Re: How to find out a date/time difference

2006-05-24 Thread Nico Grubert
= datetime.datetime(2006, 5, 24, 16, 1, 26) >>> b = datetime.datetime(2006, 5, 20, 12, 1, 26) >>> a-b datetime.timedelta(4) # 4 days >>> b = datetime.datetime(2006, 5, 20, 12, 1, 26) >>> x = a-b >>> x datetime.timedelta(4, 14400) >>&g

Rebuild list of objects with redundancies on objects' attribute

2008-01-10 Thread Nico Grubert
d gender are lists): loc name gender - tokio[john, peter] [m] madrid [susan] [f] london [alex][m] How can I do this? Thanks in advance. Nico -- http://mail.python.org/mailman/listinfo/python-list

List of paths

2009-04-01 Thread Nico Grubert
part of x so y.startswith(x) is true. The list I want to have is: ['/notebook', '/desktop', '/server/hp/proliant'] Any idea how I can do this in Python? Thanks in advance Nico -- http://mail.python.org/mailman/listinfo/python-list

Re: List of paths

2009-04-01 Thread Nico Grubert
statement! ;-) Regards Nico -- http://mail.python.org/mailman/listinfo/python-list

Re: List of paths

2009-04-08 Thread Nico Grubert
> Here's a tricky case that doesn't show up in your example: > In each case above, the directory names are distinct. > how about: >['/desk', '/desk/ethanallen', '/desk/ikea', > '/desktop', /desktop/pc', '/desktop/mac'] >Should the answer be ['/desk'] or ['/desk', '/desktop'] ? Hi Scott good po

Problem with spawning an external process

2006-04-12 Thread Nico Kruger
import time import select import threading # Change these to suit your system PATH = '/home/nico/j2sdk1.4.2/bin/java' #PATH = '/home/nico/j2sdk1.4.2/bin/java -invalid_arg' def get_ret(status): signal = status & 0xff if signal == 0: retcode =

Re: Problem with spawning an external process

2006-04-12 Thread Nico Kruger
Apologies, this is on a Fedora Core 2 system. On Wed, 2006-04-12 at 11:27, Nico Kruger wrote: > I want to execute a command (in this case, and it seems to be > significant, a Java program) in a thread in Python. When I execute the > java binary in the main python thread, everything runs

Re: Problem with spawning an external process

2006-04-12 Thread Nico Kruger
ute the > > > java binary in the main python thread, everything runs correctly. But > > > when I try and execute java in a thread, java segfaults. I am using > > > Python 2.3.3 and trying to run the java binary from the 1.4.2 SDK from > > > Sun. > > > H

Re: Problem with spawning an external process

2006-04-12 Thread Nico Kruger
Daniel, you are correct, it is not that good news for me :) But anyway, thanks to your responses, I installed Python 2.4.3 and it is working on my machine now as well. We were overdue for an upgrade to our Python environment anyways, so I think this is the final incentive to upgrade. Although, I

Re: Problem with spawning an external process

2006-04-12 Thread Nico Kruger
Not working with Python 2.3.5 here on Fedora Core 2 :(. Oh well, at least it's working on 2.4. Must be specific to something in the combination of Fedora Core 2 and Python 2.3.x, that is all I can think of. On Wed, 2006-04-12 at 12:55, Nico Kruger wrote: > Daniel, you are correct, i

ftplib timeout in Python 2.4

2009-12-17 Thread Nico Grubert
Hi there, The ftplib has a timeout parameter in Python 2.6 and above. Is there a way to set a timeout in Python 2.4? Regards Nico -- http://mail.python.org/mailman/listinfo/python-list

Re: ftplib timeout in Python 2.4

2009-12-17 Thread Nico Grubert
I don't know of one so you may need a workaround. What platforms do you > need to support? Suse Linux Enterprise 10, 64 Bit with Python 2.4.4. I need the Python 2.4.4 for a running application Server (Zope). -- http://mail.python.org/mailman/listinfo/python-list

Re: ftplib timeout in Python 2.4

2009-12-18 Thread Nico Grubert
Try the timelimited function from this recipe Works perfect! Thanks a lot, Jean! -- http://mail.python.org/mailman/listinfo/python-list

Sort list of dictionaries by key (case insensitive)

2010-01-13 Thread Nico Grubert
3}, {'title':'The thunder', 'id':4} ] How I can sort (case insensitive) the list by the dictioary's 'title' key? The result should be this list: [{'title':'the bible', 'id':3}, {'title':'the Fog', 'id':1}, {'title':'The Storm', 'id':2}, {'title':'The thunder', 'id':4} ] I am using Python 2.4. Regards, Nico -- http://mail.python.org/mailman/listinfo/python-list

Re: Sort list of dictionaries by key (case insensitive)

2010-01-13 Thread Nico Grubert
function does not excepts any keywords arguments (TypeError: sort() takes no keyword arguments), so is there a workaround? Regards Nico -- http://mail.python.org/mailman/listinfo/python-list

Re: Sort list of dictionaries by key (case insensitive)

2010-01-13 Thread Nico Grubert
sorted(items, key=lambda d: locale.strxfrm(d.get('title'))) -> [{'id': 2, 'title': 'The Storm'}, {'id': 4, 'title': 'The thunder'}, {'id': 3, 'title': 'the bible'}, {'id': 1, 'ti

Re: Sort list of dictionaries by key (case insensitive)

2010-01-13 Thread Nico Grubert
http://wiki.python.org/moin/HowTo/Sorting#Topicstobecovered Works fine. Thanks a lot for your help, Stefan. Regards Nico -- http://mail.python.org/mailman/listinfo/python-list

itertools: problem with nested groupby, list()

2010-05-04 Thread Nico Schlömer
('a') ) my_list_grouped = list( my_list_grouped ) This, however, makes it impossible to do the inner sort and groupby-operation; you just get the very first element, and that's it. An example file is attached. Hints, anyone? Cheers, Nico #! /usr/bin/env python # -*- coding: ut

Re: itertools: problem with nested groupby, list()

2010-05-04 Thread Nico Schlömer
tter('b')) ) for pass in ['first pass', 'second pass']: for b, b_iter in inner_list: print '\t', 'New B', b for b_data in b_iter: print '\t'*3, a, b, b_data print '\t', 'End

Re: itertools: problem with nested groupby, list()

2010-05-04 Thread Nico Schlömer
in that case. > which is a no-no. Create a custom iterator function (IIRC they are > called "generators") and you should be fine. I'll look into this, thanks for the hint. Cheers, Nico On Tue, May 4, 2010 at 12:46 PM, Ulrich Eckhardt wrote: > Nico Schlömer wrote: >&g

Re: itertools: problem with nested groupby, list()

2010-05-04 Thread Nico Schlömer
; for (a, b), data_iter in groupby(my_list, itemgetter('a','b')): > data = list(data) # take copy > for pass_ in ['first', 'second']: > # do something with data Potentially yes, but for now I actually need to do something at "print 

Build unordered list in HTML from a python list

2010-06-30 Thread Nico Grubert
2.1.2', 'hassubfolder':False}, ] From that list I want to create the following HTML code: Item 1 Item 2 Folder 1 Sub Item 1.1 Sub Item 1.2 Item 3 Folder 2 Sub Item 2.1 Folder 2.1 Sub Item 2.1.1 Sub Item 2.1.2 If an item of the list has 'True' for the 'hassubfolder' key than a new "" must be created instead of "" after its title. (See "Folder 2" node in the HTML code above. My problem is: How do I keep track of the closing tags while iterating over the python list? Any help is much appreciated. Regards Nico -- http://mail.python.org/mailman/listinfo/python-list

Re: Build unordered list in HTML from a python list

2010-06-30 Thread Nico Grubert
ve a short code example for me? Regards Nico -- http://mail.python.org/mailman/listinfo/python-list