Re: [SQLite] Recommended wrapper?

2007-04-23 Thread Thomas Krüger
It's all there: http://docs.python.org/lib/module-sqlite3.html Thomas -- sinature: http://nospam.nowire.org/signature_usenet.png -- http://mail.python.org/mailman/listinfo/python-list

Re: Catching a specific IO error

2007-04-24 Thread Thomas Krüger
Tina I schrieb: > Now, this works but of course it catches every IOError, and I can not > figure out how to restrict it to only catch the "[Errno 2]"? There's an example that uses the error number: http://docs.python.org/tut/node10.html#SECTION001030 Thomas -- sinature: http://

Re: os.system('tar -c * | tar -C dst') ##Any other suggestions...

2007-04-24 Thread Thomas Krüger
[EMAIL PROTECTED]: > Any suggestions on a different approach or fix? Check your commandline! The second command is wrong, -C is not valid as the only option, a command is missing. If you just want to archive files in a tarball try: "tar -c * > dst.tar" or take a look at Python's tarfile lib. Thom

Re: bitwise shift?

2007-04-25 Thread Thomas Krüger
desktop schrieb: > I have found a code example with this loop. > > for k in range(10, 25): > n = 1 << k; > > > I have never read Python before but is it correct that 1 get multiplied > with the numbers 10,11,12,12,...,25 assuming that 1 << k means "1 shift > left by k" which is the same as

Re: str() and repr() question

2007-04-26 Thread Thomas Krüger
adima schrieb: > str = DoTestTime(EachFile) ^^^ > print type(str) > for s in str: > print s > out.write(str(s)) ^^^ > Where is the problem here? > Thanks in advan

Re: Problem with class variables

2007-03-29 Thread Thomas Krüger
Dag schrieb: > I have a problem which is probaly very simple to solve, but I can't > find a nice solution. > I have the following code > > class Test: > def __init__(self): > self.a=[1,2,3,4] > self.b=self.a > def swap(self): > self.a[0],self.a[3]=self.a[3],self.a[

Re: Indentation for code readability

2007-03-30 Thread Thomas Krüger
DE schrieb: > Hello, > > Here is what I do in C++ and can not right now in python : > > pushMatrix() > { > drawStuff(); > > pushMatrix(); > { > drawSomeOtherStuff() > } > popMatrix(); > } > popMatrix(); > > The curly brackets have no functional meaning but i

Re: os.system questions

2007-03-31 Thread Thomas Krüger
Eric Price schrieb: > up = os.system("uptime") > How do I assign the output of "uptime" to the variable "up"? | >>> print os.system.__doc__ | system(command) -> exit_status | | Execute the command (a string) in a subshell. os.system returns the exitcode of the given command. To get the output try

Re: Sorting a multidimensional array by multiple keys

2007-03-31 Thread Thomas Krüger
Rehceb Rotkiv schrieb: > can I sort a multidimensional array in Python by multiple sort keys? A > litte code sample would be nice! You can pass a function as argument to the sort method of a list. The function should take two arguments and return -1, 0 or 1 as comparison result. Just like the cmp

Re: Sorting a multidimensional array by multiple keys

2007-04-01 Thread Thomas Krüger
Alex Martelli schrieb: > Thomas Krüger <[EMAIL PROTECTED]> wrote: >> def sorter(a, b): >> return cmp(a.id, b.id) >> >> obj_lst.sort(sorter) > > A MUCH better way to obtain exactly the same semantics would be: > > def getid(a): > return a.id

Re: Web App Framework with PostgreSQL + fast + easy

2007-04-02 Thread Thomas Krüger
Ben schrieb: > I'm looking for a web application framework with a good interface to > PostgreSQL. You may check out Django: http://www.djangoproject.com/ Thomas -- http://mail.python.org/mailman/listinfo/python-list

Re: Question about text in Python

2007-04-02 Thread Thomas Krüger
Steve schrieb: > I've created a Python program that a user enteres one line of text which > will then create an acronym from that text. > > What I want to add to the program is the abilty to rerun this process > (where the user enteres another line of text) until the user has had > enough and ente

Re: Why NOT only one class per file?

2007-04-04 Thread Thomas Krüger
Chris Lasher schrieb: > why should we NOT be > placing classes in their own separate files? > > Thoughts, comments, and insight much appreciated, At first: if he really like it he can place every class in a single file. But there are some reasons why Python "allows" you to place many classes in o

Re: Python on MIPS

2007-04-06 Thread Thomas Krüger
Lorenzo Mainardi schrieb: > I bought a very small embedded card, with a MIPS processor, running > Linux. So, I would to use Python on that; I checked on python.org, but I > did'nt find any release for this architecture. Could you help me? How about compiling it from source? Thomas -- http://mail

Re: Using os.popen3() to get binary data

2007-04-06 Thread Thomas Krüger
Christoph Krammer schrieb: > for image in images: > if (image[0:3] == 'GIF'): > (si, so, se) = os.popen3('giftopnm -image=all', 'b') > si.write(image) > frame = so.readlines() > > But with this code the script just hangs. When I interrupt the script, > I get the following er

Re: Why does not my wx.html.HtmlWindow work?

2007-04-07 Thread Thomas Krüger
[EMAIL PROTECTED] schrieb: > html.LoadPage(" > http://www.pythonthreads.com/articles/python/incorporating-into-wxpython-part-1.html";) Quickshot: There's a space at the start of your URI. Thomas -- http://mail.python.org/mailman/listinfo/python-list

Re: Crypto Suggestion/Help

2007-04-08 Thread Thomas Krüger
Jimmy E Touma schrieb: > I need some advise on doing the following. I have a Linux application > that allows users to access it via a code (password). At the end of the > day, I gather a log of activities of the users and zip the file and > would like to encrypt it so that the users can not access

Re: Is there a simple function to generate a list like ['a', 'b', 'c', ... 'z']?

2007-04-09 Thread Thomas Krüger
人言落日是天涯,望极天涯不见家 schrieb: > Is there a simple function to generate a list like ['a', 'b', 'c', ... > 'z']? The range() just can generate the numeric list. There is: [ chr(i) for i in range(97, 123) ] Thomas -- http://mail.python.org/mailman/listinfo/python-list

Re: Queue get timeout parameter question

2007-04-10 Thread Thomas Krüger
Godzilla schrieb: > I have been using the queue module for a multithreaded environment and > things seem to work well... until we had a requirement for the > application to be able to time sync to the server. With the time sync, > it actually disorientated the timeout in the queue's get() method...

Re: THREADS use 100 % CPU all the time

2007-04-11 Thread Thomas Krüger
[EMAIL PROTECTED] schrieb: > while (True): > pass > Does anyone know how to run this without consuming all CPU. Your while loop is taking all the CPU time. Thomas -- sinature: http://nospam.nowire.org/signature_usenet.png -- http://mail.python.org/mailman/listinfo/python-list

Re: Authenticating clients and servers

2007-04-15 Thread Thomas Krüger
Chaz Ginger schrieb: > I am writing a distributed server system using Python. I need to support > authentication and was wondering what approaches are available under > Python and what are the best practices. Well, there are many ways of client authentication. To narrow it down it would be nice if

Re: Authenticating clients and servers

2007-04-15 Thread Thomas Krüger
Thomas Krüger schrieb: > Many protocols support an additional SSL/TLS-Layers (e.g. HTTP -> > HTTPS). There you can use SSL certificate authentication. It may > berequired to set up a small CA, but done right it is pretty secure. I missed the best: The Twisted framework has SSL au