Re: Classes and Functions - General Questions

2006-10-18 Thread Sybren Stuvel
Setash enlightened us with: > 1) Classes. How do you extend classes? > > I know its as easy as: > > class classname(a) >do stuff > > > But where does the parent class need to lie? In the same file? Can > it lie in another .py file in the root directory? It doesn't matter at all, as long as 'a'

Re: Classes and Functions - General Questions

2006-10-19 Thread Sybren Stuvel
Setash enlightened us with: >> class1.py: >> >> class Class1(object): >> pass >> >> class2.py: >> import class1 This line imports class1.py and places its contents under the name "class1". > classes.py: > > class Class1 > pass > > class Class2(Class1) > pass That's co

Re: Python Source

2006-10-21 Thread Sybren Stuvel
ArdPy enlightened us with: > Is it possible to hack through the code written by Guido van Rossum > that makes the python interpreter. Yes it is. > If yes please let me know how to begin. If its not then pardon me. Download the source, start hacking. Sybren -- Sybren Stüvel Stüvel IT - http:/

Re: Detect Unused Modules

2006-10-21 Thread Sybren Stuvel
Kamilche enlightened us with: > DetectUnusedModules.py - Detect modules that were imported but not > used in a file. When run directly, this class will check all files > in the current directory. Nice as it is, but why not use pylint to check this and many other coding style issues? Sybren -- S

Re: Python and CMS

2006-10-23 Thread Sybren Stuvel
Kjell Magne Fauske enlightened us with: > I recommend taking a look at Django [1]. It is not a CMS right out > of the box, but writing one using the Django framework is not that > difficult. Django is my favourite as well. It's very easy to start building a dynamic website. Sybren -- Sybren Stü

Re: Change on file

2006-10-24 Thread Sybren Stuvel
Fulvio enlightened us with: > I was thinking about use md5 check to se if a file had changes since > last check. Am I correct? You can do that, but a check on the mtime (os.stat) would be a lot easier. Sybren -- Sybren Stüvel Stüvel IT - http://www.stuvel.eu/ -- http://mail.python.org/mailman

Re: A py2exe like tool for Linux

2006-10-24 Thread Sybren Stuvel
Paolo Pantaleo enlightened us with: > is thre something like py2exe for Linux? I don't need to build a > standalone executable (most Linuxes have python instaled), but at > least I need to provide all the needed libraries togheter with my > source code, so users just need to download one file, and

Re: displaying \n-less prompts in a pythonic way

2006-10-26 Thread Sybren Stuvel
alf enlightened us with: > I have a command line program which also does some interaction with the > user using stdin and stdout. > > My requirement is to print prompt so the user can answer in the same > line. Unfortunately: > > print 'enter command:', > > > does not really work as the comma i

Re: which one of these is better?

2006-10-26 Thread Sybren Stuvel
John Salerno enlightened us with: > Hmm, looks like this doesn't work anyway if open() doesn't work, > because then f.close() raises an UnboundLocalError for obvious > reasons. Neither work 100% correct, actually. If the file can be located and opened, but not read, the message Could not loca

Re: other ways to check for ?

2006-11-02 Thread Sybren Stuvel
elderic enlightened us with: > are there other ways than the ones below to check for 'function'> in a python script? First of all, why would you want to? If you want to call the object as a function, just do so. Handle the exception that is raised when it's raised. Sybren -- Sybren Stüvel Stü

Re: other ways to check for ?

2006-11-02 Thread Sybren Stuvel
Christophe enlightened us with: > I don't think it's a good idea because when you place a try catch > block around a function call, you'll catch any exception thrown by > the function itself and not only the "cannot be called" exception. That depends on the exception you're catching, doesn't it?

Re: An algorithm problem

2006-05-31 Thread Sybren Stuvel
Bo Yang enlightened us with: > I have writen a python program to slove a problem described as > below: Please post again, but then leaving indentation intact, since this is unreadable. Sybren -- The problem with the world is stupidity. Not saying there should be a capital punishment for stupidit

Re: Best Python Editor

2006-05-31 Thread Sybren Stuvel
Manoj Kumar P enlightened us with: > Can anyone tell me a good python editor/IDE? > It would be great if you can provide the download link also. VIM 7 is great, http://www.vim.org/ Sybren -- The problem with the world is stupidity. Not saying there should be a capital punishment for stupidity, b

Re: shuffling elements of a list

2006-05-31 Thread Sybren Stuvel
David C Ullrich enlightened us with: > I thought that the fact that you could use the same trick for > _shuffling_ a list was my idea, gonna make me rich and famous. I > guess I'm not the only one who thought of it. Anyway, you can use > DSU to _shuffle_ a list by decorating the list with random n

Re: Best way to do data source abstraction

2006-06-01 Thread Sybren Stuvel
Arthur Pemberton enlightened us with: > What is the best way to do data source abtraction? That depends on your data source. For files, file-like objects are an abstraction. For databases there is PEP 249. > I was thinking of almost having classA as my main class, and have > classA dynamically "a

Re: Max function question: How do I return the index of the maximum value of a list?

2006-06-04 Thread Sybren Stuvel
jj_frap enlightened us with: > When I try to print the "winner" (I've not coded for kicker strength > and ties yet) via the max function, it returns the maximum value in > the list rather than the index associated with that value. > > How do I return the index? You can't even be sure it exists - t

Re: C# equivalent to range()

2006-06-06 Thread Sybren Stuvel
Erik Max Francis enlightened us with: >> The other zilion persons who were not interested (other than the four I >> mentioned above) silently and peacefully ignored the question on went >> on with their happy lifes. > > That's because many of them have killfiled you. I can say that I didn't killfi

Re: FYI: getting data from an OpenOffice.org spreadsheet

2006-09-03 Thread Sybren Stuvel
Hi folks, I just noticed I still had the "no archive" header on, which is rather stupid. If I want to make life easier for people, the information I posted in this thread should be archived! Here is a small summary: Get data from an OpenOffice.org spreadsheet with a Python script. It works on the

Re: FYI: getting data from an OpenOffice.org spreadsheet

2006-09-03 Thread Sybren Stuvel
John Machin enlightened us with: > Suppose one has over a hundred spreadsheets (real-life example: > budgets from an organisation's reporting centres) ... manually > opening each in OOo Calc is less than appealing, and not very > robust. True. There are functions that can load files as well. Combi

Re: FYI: getting data from an OpenOffice.org spreadsheet

2006-09-03 Thread Sybren Stuvel
John Machin enlightened us with: > Firstly, let me say that you are highly commended for wading so far > into the OOo docs and producing two pieces of code that actually do > something. I've opened up the docs two or three times, said "Waaahht > the " and closed them rapidly. Thanks. I had the

Re: Exception EOFError.

2006-09-04 Thread Sybren Stuvel
Dennis Lee Bieber enlightened us with: > The above is windows, I believe Linux uses instead of > That's correct. And so do all unix systems including MacOS X. Sybren -- Sybren Stüvel Stüvel IT - http://www.stuvel.eu/ -- http://mail.python.org/mailman/listinfo/python-list

Re: threading support in python

2006-09-04 Thread Sybren Stuvel
km enlightened us with: > Is there any PEP to introduce true threading features into python's > next version as in java? i mean without having GIL. What is GIL? Except for the Dutch word for SCREAM that is... > when compared to other languages, python is fun to code but i feel > its is lacking be

[Article] OpenOffice.org and Python

2006-09-05 Thread Sybren Stuvel
Hi folks! The two small snippets I wrote two days ago were well received. With the danger of being called a hero I proceded and wrote a proper article about OpenOffice.org and Python. It contains the following sections: * Preparation * Gaining access to a document * Getting to the d

Re: [ANN] IronPython 1.0 released today!

2006-09-05 Thread Sybren Stuvel
Jim Hugunin enlightened us with: > I'm extremely happy to announce that we have released IronPython 1.0 > today! http://www.codeplex.com/IronPython Congratulations! > We were also able to release IronPython publicly from Microsoft with > a BSD-style license. [...] Without the drive and input of

Re: [Article] OpenOffice.org and Python

2006-09-06 Thread Sybren Stuvel
MC enlightened us with: > Thanks! You're welcome! > - and Python 2.4.x? I've used Python 2.4.3 to write the article. > - I have Python 2.4 and then "embbed Python 2.3 of OOo" ; how > install some things in this last Python? I dream to call Pywin32 > from OOo... Please rephrase that qu

Re: OpenOffice.org and Python

2006-09-06 Thread Sybren Stuvel
olive enlightened us with: > you did not understand Michel question because Ubuntu seems to be > the only distribution coming with OpenOffice and Python 2.4 compiled > together. Ah, okay. I have no other distributions here, so I rely on others to give me more information about them. > Others plat

Re: sending emails using python

2006-09-07 Thread Sybren Stuvel
sridhar enlightened us with: > iam having user account on an exchangeserver. > with that can i send an email using python? > > if iam using the following code iam getting error > > > fromAddress = '[EMAIL PROTECTED]' > toAddress = '[EMAIL PROTECTED]' > msg = "Subject: Hello\n\nThis is the body of t

Re: sending emails using python

2006-09-07 Thread Sybren Stuvel
Steve Holden enlightened us with: > This is untrue for the Python smtplib, though correct according to > the RFCs. The SMTP.data() method uses a locally-declared function > called quotedata() to ensure the correct line endings, so using "\n" > will result in the same message as using "\r\n". Ah, w

Re: sending emails using python

2006-09-07 Thread Sybren Stuvel
Tim Williams enlightened us with: > Can you send email via it using outlook express or a similar > POP3/IMAP mail client? Wouldn't you use a SMTP client to send email? Sybren -- Sybren Stüvel Stüvel IT - http://www.stuvel.eu/ -- http://mail.python.org/mailman/listinfo/python-list

Re: How to build extensions on Windows?

2006-09-07 Thread Sybren Stuvel
Kevin D Smith enlightened us with: > I've written a simple Python extension for UNIX, but I need to get > it working on Windows now. I'm having some difficulties figuring > out how to do this. I had to do the same, and I didn't get much result. My solution: install Cygwin, use the Python that co

Re: Request for tips on my first python script.

2006-09-08 Thread Sybren Stuvel
Lex Hider enlightened us with: > Any tips on the code quality and use of python would be appreciated. > I've got a feeling the overall structure is up the creek. I'll post some remarks about the code ;-) > HOME = os.path.expanduser("~") I wouldn't use this. Just use os.environ['HOME']. In most c

Re: QuoteSQL

2006-09-24 Thread Sybren Stuvel
Lawrence D'Oliveiro enlightened us with: > Why doesn't MySQLdb provide a function like this: Because generally you're able to pass newlines and the like just fine. You can even store binary data into a BLOB column. Sybren -- Sybren Stüvel Stüvel IT - http://www.stuvel.eu/ -- http://mail.pytho

Re: License / Registration key enabled software

2006-09-24 Thread Sybren Stuvel
T enlightened us with: > We all know that there are many softwares that require some license > key or registration key to enable them. How does one implement > something like this in python? Why do you want to? I've never seen software successfully protected by such schemes. If you really want to

Re: Automatic import PEP

2006-09-24 Thread Sybren Stuvel
Connelly Barnes enlightened us with: > I wrote the 'autoimp' module [1], which allows you to import lazy modules: > > The main point of autoimp is to make usage of the interactive Python > prompt more productive by including "from autoimp import *" in the > PYTHONSTARTUP file. Sounds like a great

Re: QuoteSQL

2006-09-24 Thread Sybren Stuvel
Lawrence D'Oliveiro enlightened us with: > Yes, I have done blobs. Still need a quoting function for the > specials, though. Why? What makes your data so different from mine? I can store newlines and the likes just fine in a regular text field. Sybren -- Sybren Stüvel Stüvel IT - http://www.st

Re: Talking to marketing people about Python

2006-09-25 Thread Sybren Stuvel
Roy Smith enlightened us with: > I'm working on a product which for a long time has had a Perl > binding for our remote access API. A while ago, I wrote a Python > binding on my own, chatted it up a bit internally, and recently had > a (large) customer enquire about getting access to it. > > I ask

Re: QuoteSQL

2006-09-25 Thread Sybren Stuvel
Lawrence D'Oliveiro enlightened us with: > "select * from details where person_name like" > " concat(\"%%\", %s, \"%%\")" \ > % \ > QuoteSQL(name, True) Wouldn't this be a whole lot better? cursor.execute( "select * from details where person_name like ?", '%' +

Re: QuoteSQL

2006-09-25 Thread Sybren Stuvel
Lawrence D'Oliveiro enlightened us with: >> Wouldn't this be a whole lot better? >> >> cursor.execute( >> "select * from details where person_name like ?", >> '%' + name + '%' >> ) > > No. Can you figure out why? Ok, should have tested it better. This works fine on my machine, though: cu

Re: QuoteSQL

2006-09-25 Thread Sybren Stuvel
Duncan Booth enlightened us with: > I think his point was that any '%' characters inside name act like > wildcards whereas his version looked for literal percents. But of course. > This could be an argument for having a utility function to escape > the wildcards for this sort of situation, but ce

Re: QuoteSQL

2006-09-25 Thread Sybren Stuvel
Lawrence D'Oliveiro enlightened us with: >> An escaping function should be small and not do all kinds of >> escaping for different situations at once. > > Even when the two situations are related? Yup, even then. Different situations need different escaping functions. Sybren -- Sybren Stüvel St

Re: R.S.I. solutions?

2006-09-25 Thread Sybren Stuvel
Paddy enlightened us with: > All this keyboarding has finally caught up with me and I'm getting > aches in my fingers. Use more force with your fingers, and take regular typing breaks. Often RSI is caused by subtle movements without applying a lot of force. Another good way to beat RSI is to lea

Re: QOTW (was Re: does anybody earn a living programming in python?)

2006-09-26 Thread Sybren Stuvel
Aahz enlightened us with: > Fredrik Lundh <[EMAIL PROTECTED]> wrote: >> >>well, if you're only watching mtv, it's easy to think that there's >>obviously not much demand for country singers, blues musicians, >>British hard rock bands, or melodic death metal acts. > > Any other votes for this being

Re: Extend file type

2006-09-26 Thread Sybren Stuvel
abcd enlightened us with: > Any suggestions on how to find out? I did try adding to MyFile > > def __call__(self, *args): > print "calling:", args > return file.__call__(self, *args) > > but I never see that either. I don't know the answer to your problem, but I can explain why this d

Re: QuoteSQL

2006-09-26 Thread Sybren Stuvel
Lawrence D'Oliveiro enlightened us with: > The trouble with this is that, instead of offering extra functionality, it > leaves the door open to making two stupid mistakes: > > 2) quoting of wildcards BEFORE quoting of non-wildcards Why is this a "stupid" mistake in your view? Please explain th

Re: concat next line with previous

2006-09-26 Thread Sybren Stuvel
[EMAIL PROTECTED] enlightened us with: > hi > what is the python way to concat 2 lines eg concated = line1 + line2 Sybren -- Sybren Stüvel Stüvel IT - http://www.stuvel.eu/ -- http://mail.python.org/mailman/listinfo/python-list

Re: where are isinstance types documented?

2006-09-26 Thread Sybren Stuvel
codefire enlightened us with: > I'm using the isinstance built-in function. I've found the docs for > it, but there are no docs on the supported types. All types/classes are supported. > For example isinstance(a, int) works fine but isinstance(s, string) > doesn't - because 'string is not known'.

Re: QuoteSQL

2006-09-26 Thread Sybren Stuvel
Lawrence D'Oliveiro enlightened us with: > You're proposing two separate functions: > > 1) quoting of non-wildcard specials > 2) quoting of wildcard specials I'm suggesting functions based on the role of the string they need to escape, not the characters in that string. 1) Quoting of

Re: QuoteSQL

2006-09-26 Thread Sybren Stuvel
Lawrence D'Oliveiro enlightened us with: > Because quoting the wildcards introduces backslash specials before > each wildcard. Quoting non-wildcards then causes those backslashes > to be doubled, which means they escape themselves instead of the > wildcards. I don't know about other DBMSes, but in

Re: does anybody earn a living programming in python?

2006-09-26 Thread Sybren Stuvel
walterbyrd enlightened us with: > If so, I doubt there are many. > > I wonder why that is? www.uwklantprofiel.nl and www.uwpensioenanalyse.nl, both systems are written in Python, although the website of the former is still in PHP. It'll be Python soon, too. I've created both systems. Sybren --

Re: QuoteSQL

2006-09-26 Thread Sybren Stuvel
Tim Chase enlightened us with: > >>> cur.execute("select * from people where last_name in (%s)" % > ','.join('%s' for i in xrange(len(t))), > t) But since the value of 'i' isn't used at all, it can be abbreviated to: >>> cur.execute("select * from people where last_name in (%s)" %

Re: QuoteSQL

2006-09-26 Thread Sybren Stuvel
Fredrik Lundh enlightened us with: > and now we're waiting for the "['%s']*len(t)" vs. "'%s' for i in t" > benchmarks (and the "consistency is more important than efficiency" > and "creating extra objects is conceptually wrong" followups, and > the "it depends on what you mean by" followups to the

Re: License / Registration key enabled software

2006-09-28 Thread Sybren Stuvel
Steve Holden enlightened us with: > Otherwise you might as well say that any costs associated with using > a piece of software (including purchase pricing) are "hostile to the > wants of the user". It's true. People pay because they have to, but they'd rather not. Sybren -- Sybren Stüvel Stüve

Re: License / Registration key enabled software

2006-09-28 Thread Sybren Stuvel
Mike Playle enlightened us with: > Imagine you're an IT manager for a medium-to-large company who wants > to use some expensive piece of software. You talk to the vendor and > buy a licence to use the software on up to 5 machines at once, but > you don't know who in the company will want to use it,

Re: License / Registration key enabled software

2006-09-28 Thread Sybren Stuvel
Steve Holden enlightened us with: > And you guarantee that the contents of the smartcard is only used by > one user at a time by building a licensing system for the > smartcards? We can never, ever make a 100% guarantee that people won't copy what you supply them. The only way to do that is to tho

Re: using the email module

2006-09-28 Thread Sybren Stuvel
Erik Johnson enlightened us with: > When I run this and view the email I receive in MS Outlook Express, > what I see is the HTML rendered in the body of the message, my body > is not seen anywhere and there is no attachment. If the HTML document should really be attached, give it a Content-Dis

Re: using the email module

2006-09-28 Thread Sybren Stuvel
Erik Johnson enlightened us with: > # Ah! Yes, that works! Thank you! ;) You're welcome! Sybren -- Sybren Stüvel Stüvel IT - http://www.stuvel.eu/ -- http://mail.python.org/mailman/listinfo/python-list

Re: retry in exception

2006-09-29 Thread Sybren Stuvel
Antoine De Groote enlightened us with: > I hope I don't upset anybody by comparing Python to Ruby (again). Is > there something like Ruby's retry keyword in Python? Please don't assume that everybody knows Ruby through and through... Sybren -- Sybren Stüvel Stüvel IT - http://www.stuvel.eu/ -

Re: Making sure script only runs once instance at a time.

2006-09-29 Thread Sybren Stuvel
Tim Williams enlightened us with: > def check_lock(): > import os, sys > try: > os.remove({filename}) > except: > if "Permission denied" in sys.exc_info()[1]: > print 'This program is already running' > sys.exit() > f_lock = open({filename},'w

Re: Python/UNO/OpenOffice?

2006-09-30 Thread Sybren Stuvel
[EMAIL PROTECTED] enlightened us with: > Are then any currently active and reasonably mature Python plugins/ > apis/whatever for programming/scripting OpenOffice? The page I've > found is http://udk.openoffice.org/python/python-bridge.html, but it > was last updated more than a year ago. Aside fro

Re: for: else: - any practical uses for the else clause?

2006-09-30 Thread Sybren Stuvel
Paul Rubin enlightened us with: >> height = 0 >> for block in stack: >> if block.is_marked(): >> print "Lowest marked block is at height", height >> break >> height += block.height >> else: >> raise SomeError("No marked block") > > all_heights = [block.height for blo

Re: builtin regular expressions?

2006-09-30 Thread Sybren Stuvel
Antoine De Groote enlightened us with: > Can anybody tell me the reason(s) why regular expressions are not built > into Python like it is the case with Ruby and I believe Perl? They _are_ built into Python. Python ships with the 're' module. > Python Culture says: 'Explicit is better than implic

Re: Escapeism

2006-09-30 Thread Sybren Stuvel
Kay Schluehr enlightened us with: > Usually I struggle a short while with \ and either succeed or give up. > Today I'm in a different mood and don't give up. So here is my > question: > > You have an unknown character string c such as '\n' , '\a' , '\7' etc. > > How do you echo them using print? >

Re: Python/UNO/OpenOffice?

2006-10-01 Thread Sybren Stuvel
John Machin enlightened us with: > Hi, Sybren. I tried folloing your recipe on Windows with OOo 2.0 ... > > Minor problem: the executable is called soffice, not ooffice. > > Major problem: it crashed right at the start, somewhere in the maze > of dlls. That's not nice. > Has anyone managed to get

Re: Python/UNO/OpenOffice?

2006-10-02 Thread Sybren Stuvel
John Machin enlightened us with: > Many thanks for all that, olive; I made the minimal hacks to make it > open an XLS ffile, and it worked! > I'll try to see why that worked and my previous experiment crashed > inside a DLL. Thanks, keep us posted! Sybren -- Sybren Stüvel Stüvel IT - http://ww

Re: Pythonic API design: detailed errors when you usually don't care

2006-10-02 Thread Sybren Stuvel
Simon Willison enlightened us with: > try: > do_something() > except HttpError: > # An HTTP error occurred > except ApplicationError: > # An application error occurred > else: > # It worked! > > This does the job fine, but has a couple of problems. > I anticipate that most people using my

Re: Best way to handle large lists?

2006-10-03 Thread Sybren Stuvel
Bill Williams enlightened us with: > I don't know enough about Python internals, but the suggested > solutions all seem to involve scanning bigList. Can this presumably > linear operation be avoided by using dict or similar to find all > occurrences of smallist items in biglist and then deleting th

Re: How to get keyboard event in Linux console?

2006-10-03 Thread Sybren Stuvel
Jia,Lu enlightened us with: > I want to deal keyboard event in Linux console. > Example: I Create a deamon at background and when I press F1 key > then print Hello at Console. Type "who" and see which PTY you're connected to: sybren pts/02006-10-04 07:55 (klappie.stuvel.eu) So I'm conn

Re: Executing python script in non-interactive mode on cygwin (windows)

2006-01-23 Thread Sybren Stuvel
Pankaj enlightened us with: > But i think python is worse than perl No it isn't. > It takes to interactive mode , which i don;t want to use. Then don't use it. > "python scriptname.py" > does not execute python script Yes it does. > 1. I placed these contents in a file named "1.py" > a,b=0,1

Re: Apache with Python 2.4 Need Help !!!

2006-01-25 Thread Sybren Stuvel
pycraze enlightened us with: > I am currently using Fedora Core - 3 with apache 2.0 Web Server and > Python 2.4 . > > [...] i would like to know have apache released any version that can > be successfully use Python 2.4 ( with mod-python module ) using > Fedora Core -3 . I don't know about Fedora

Re: Apache with Python 2.4 Need Help !!!

2006-01-25 Thread Sybren Stuvel
rbt enlightened us with: > This was my first real go at using mod_python. It was a bit > different, but once I got the hang of it, I like it very much. > Existing py scripts need little modification to work, and if you've > done any PHP or Perl web projects in the past, you'll understand 50% > of i

Re: Nitpicking - slightly misleading traceback

2006-01-26 Thread Sybren Stuvel
Juho Schultz enlightened us with: > However, the bug sits on the next line. [...] I feel the traceback > is misleading. Well, the bug sits in the command starting on the line indicated. Nitpick back: Learn about operator precedence and Python syntax rules. You don't need so many brackets: if dat

Re: Match First Sequence in Regular Expression?

2006-01-26 Thread Sybren Stuvel
Roger L. Cauvin enlightened us with: > I'm looking for a regular expression that matches the first, and > only the first, sequence of the letter 'a', and only if the length > of the sequence is exactly 3. Your request is ambiguous: 1) You're looking for the first, and only the first, sequence of

Re: any way to customize the is operator?

2006-01-27 Thread Sybren Stuvel
Lonnie Princehouse enlightened us with: > There doesn't seem to be any way to customize the behavior of "is" as > can be done for other operators... why not? Pure logic: A == A or A != A. An object is another object or not. Why would you want to change that? Sybren -- The problem with the world

Re: File date attribute

2006-01-28 Thread Sybren Stuvel
Bruce R Graham enlightened us with: > Run a script in cron.daily. The script should check a timestamp > placed by the last occurrence of that script. Then check my home > folder for files modified between that timestamp and now. Then send > those files off to gmail. > I have most of the pieces in p

Re: Python vs C for a mail server

2006-01-28 Thread Sybren Stuvel
Jim Segrave enlightened us with: > Any lecturer assigning "write a mail server" as a class project is > doing his/her students a true dis-service. At one time, I got an assignment "Write a robust, user friendly SMTP client". That was just after we learned how to user 'for' loops and 'if' statemen

Re: adding current date to a file name in a python script

2006-01-29 Thread Sybren Stuvel
[EMAIL PROTECTED] enlightened us with: > myFile = '/work/output1' > myFile = myFile.join(today) > myFile = myFile.join(".txt") join does something completely different. You want: myFile = '/work/output1/%s.txt' % today Sybren -- The problem with the world is stupidity. Not saying there should b

Re: Python vs C for a mail server

2006-01-29 Thread Sybren Stuvel
Dan Lowe enlightened us with: > I'm on my second major mail system deployment built around Exim, and > would recommend it to anybody needing a robust, flexible mail > server. Same here. I used Sendmail, QMail, Exim 3 and Exim 4, and out of those, Exim 4 came out winner. Sybren -- The problem wit

Re: OpenRTS - new OSS Python game

2006-02-01 Thread Sybren Stuvel
Andreas R. enlightened us with: > OpenRTS is a new open source project, with the aim of creating a > realtime strategy game. The game is developed in Python with Pygame. > See http://www.openrts.org for more info about the game if you are > interested. To be honest, it looks very much like games f

Re: OpenRTS - new OSS Python game

2006-02-01 Thread Sybren Stuvel
Andreas R. enlightened us with: > The game has isometric graphics. It's possible to have nice > isometric graphics, ie. look at Civilization 3. Besides, there's a > lot more to a good strategy game than good looks. True. That's why I only commented on the graphics - that's the only visible thing

Re: redirect and python

2006-02-02 Thread Sybren Stuvel
questions? enlightened us with: > The things put to screen doesn't redirect to the file I want. What do you see on screen? What do you want to redirect to the file? > What's the trick in here? Giving us useful information. Sybren -- The problem with the world is stupidity. Not saying there sho

Re: Detecting line endings

2006-02-06 Thread Sybren Stuvel
Fuzzyman enlightened us with: > My worry is that if '\n' *doesn't* signify a line break on the Mac, > then it may exist in the body of the text - and trigger ``ending = > '\n'`` prematurely ? I'd count the number of occurences of '\r\n', '\n' without a preceding '\r' and '\r' without following '\n

Re: Detecting line endings

2006-02-07 Thread Sybren Stuvel
Fuzzyman enlightened us with: > This is what I came up with. [...] Comments/corrections welcomed. You could use a little more comments in the code, but apart from that it looks nice. Sybren -- The problem with the world is stupidity. Not saying there should be a capital punishment for stupidity,

Re: CLI

2006-02-09 Thread Sybren Stuvel
mwt enlightened us with: > I want to do programmatic terminal commands on unix with python If you want to use a real terminal, search for pty. If you just want to start and stop scripts, check the popen2 module. Sybren -- The problem with the world is stupidity. Not saying there should be a cap

Re: breaking from loop

2006-02-10 Thread Sybren Stuvel
Ritesh Raj Sarraf enlightened us with: > bFound = True > break > return bFound I see two weird things. First of all, the retun statement won't be reached due to the break before it. Let's assume the break isn't needed, and you

Re: Netstat in python. Does it's possible?

2006-02-11 Thread Sybren Stuvel
billie enlightened us with: > Hi all. I don't know if Python is good for this kind of jobs but I'm > wondering if it's possible emulate the "netstat" command in Python. On Linux, you can read /proc for that info, iirc. Sybren -- The problem with the world is stupidity. Not saying there should be

Re: Python / Apache / MySQL

2006-02-14 Thread Sybren Stuvel
vpr enlightened us with: > I want to build an Website using Apache / Python and MySQL. I second Bruno: swap MySQL in favour of PostgreSQL. > e.g. should I be using mod_python ? You could use my framework based on mod_python and Cheetah. I find it really easy to use. Check out http://www.unrealto

Re: Python / Apache / MySQL

2006-02-14 Thread Sybren Stuvel
Kalle Anke enlightened us with: > What about speed? I've always had the impression that while > PostgreSQL is more complete than MySQL it's also slower. For simple queries, I believe (no real knowledge here) MySQL is indeed faster. One of the problems I have with MySQL is that it doesn't support f

Re: Python / Apache / MySQL

2006-02-14 Thread Sybren Stuvel
Dennis Lee Bieber enlightened us with: > I believe that since 4.1, the "default table format" is InnoDB, and > that DOES have some support foreign keys and transactions. Finally they are starting to make more sense. I'd still rather use a database that has had those features for a longer time, tho

Re: pop line from file

2006-02-15 Thread Sybren Stuvel
Sinan Nalkaya enlightened us with: > i searched and google long long time but couldnt find any result, i > want pop the first line from file, i dont want to read all file > contents because file is being updated from another proccess. So basically, what you want is some sort of on-disk FIFO queue,

Re: xml.dom.ext documentation

2006-02-17 Thread Sybren Stuvel
[EMAIL PROTECTED] enlightened us with: > I figure I must just be missing something, but I can't seem to find > good documentation for xml.dom.ext. What I'm hoping for is just a > simple list of what actually is available in that package (what > other packages get included if you import xml.dom.ext

Re: Simple question about freeze

2006-02-17 Thread Sybren Stuvel
Martin v. Löwis enlightened us with: > No. You also need to provide static versions of all system > libraries. You can also ship the required .so files along with the program, and set LD_LIBRARY_PATH to include the directory in which you stored those files. This can be easily done by a shell scrip

Re: How many web framework for python ?

2006-02-19 Thread Sybren Stuvel
Bruno Desthuilliers enlightened us with: >> I want to write a web framework for python based on mod_python as >> my course homework , could you give some advise ? > > Yes : forget it. Why forget it? I've written my own web framework (http://www.unrealtower.org/) and it works great! It was a good l

Re: How many web framework for python ?

2006-02-19 Thread Sybren Stuvel
Ville Vainio enlightened us with: > When you write your own framework, you are helping yourself. True. And if that doesn't have a negative effect on others (which I think it doesn't) there is nothing wrong with that. > If you use an existing framework and possibly contribute patches to > it, you

Re: editor for Python on Linux

2006-02-19 Thread Sybren Stuvel
Mladen Adamovic enlightened us with: > I wonder which editor or IDE you can recommend me for writing Python > programs. I tried with jEdit but it isn't perfect. I use gvim (if I have X) and vim (if I don't). The only negative thing about it, is its learning curve ;-) Sybren -- The problem with

Re: Is inifinite loop not a good practice?

2006-02-20 Thread Sybren Stuvel
Alvin A. Delagon enlightened us with: > I have to write a python script that would continously monitor and > process a queue database. [...] I've been planning to do an infinite > loop within the script to do this but I've been hearing comments > that infinite loop is a bad programming practice. I

Re: Canvas clicking stuff

2006-02-20 Thread Sybren Stuvel
Tuvas enlightened us with: > I have a picture that is being displayed on a canvas interface, that > I want to do the following. [...] There are loads of GUI toolkits you could be using. Please read "How To Ask Questions The Smart Way": http://catb.org/~esr/faqs/smart-questions.html It's a very g

Re: deriving from float or int

2006-02-20 Thread Sybren Stuvel
Russ enlightened us with: > Does it ever make sense to derive a class from a basic type such as > float or int? Suppose, for example, that I want to create a class > for physical scalars with units. That makes sense. > I thought about deriving from float, then adding the units. I played > around

Re: Video.

2006-02-21 Thread Sybren Stuvel
Dr. Pastor enlightened us with: > What environment,library,product should I import or study to > manipulate cameras, video, fire-wire, avi files? That depends on what you want with it. Without more information I'd say "transcode" Sybren -- The problem with the world is stupidity. Not saying ther

Re: deriving from float or int

2006-02-21 Thread Sybren Stuvel
Russ enlightened us with: > The problem is that when I derive a new class from float, the darn > thing won't let me create a constructor that accepts more than one > argument. Use __new__, not __init__. It's the function that's called when a new immutable object is created. Sybren -- The problem

Re: a little more help with python server-side scripting

2006-02-22 Thread Sybren Stuvel
John Salerno enlightened us with: > What I had asked was if I could just embed Python code within my > HTML files, like you do with PHP, but they didn't address that yet. Check out PSP. Sybren -- The problem with the world is stupidity. Not saying there should be a capital punishment for stupidi

<    1   2   3   4   5   >