Re: [Tutor] Looking for HOWTO's

2005-06-03 Thread Cedric BRINER
Maybe this is Off-Topic but I found recently a perfect repository of python tutorials at: http://www.awaretek.com/tutorials.html Ced. -- Cedric BRINER ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] interactif or not

2005-06-03 Thread Cedric BRINER
hi, How can I know if a script is launched interactively or not because I'd like to make a script verbose or not depending if it is executed as interactive or not. eg. If I invoke it in a shell.. then it can be verbose If it is launched from a crontab.. then it is less verbose. Ced. --

[Tutor] Postgresql+Python -tutorial?

2005-06-03 Thread Olli Rajala
Hi! I've been using MySQL up this day, but would like to convert my program to use Postgresql. There seems to be awful lots of tutorials for MySQL+Python, but not so many for Postgresql+Python. Where should I start? I'm not very good at database things, but have written some little programs with

Re: [Tutor] Py2exe Problem

2005-06-03 Thread Joseph Quigley
Traceback (most recent call last): File NovusExtension.pyw, line 8, in ? File Pmw\__init__.pyc, line 28, in ? WindowsError: [Errno 3] El sistema no puede hallar la ruta especificada: this: WindowsError: [Errno 3] El sistema no puede hallar la ruta especificada: is spanish for:

Re: [Tutor] Py2exe Problem

2005-06-03 Thread Alberto Troiano
Hey Thanks for the docs I finally was able to make a good compilation After I freezed Pmw into pmw.py I had to restart Python (Ctrl-Alt-Del and terminate all python process that were running, by the way why they still stay there and how can I terminate them?) and only then the compilation

[Tutor] question about hiding a function/method in a class

2005-06-03 Thread Mike Hansen
I haven't done much OO in Python yet. For various web apps we write, we usually write up a DB schema in a spreadsheet. Then we write the sql script that would create the tables in the database. I thought it would be neat to save the spreadsheet as a csv file and have python write the sql

Re: [Tutor] question about hiding a function/method in a class

2005-06-03 Thread Kent Johnson
Mike Hansen wrote: class DBField(object): def __init__(self, fieldName): self.fieldName = fieldName self.type = self.size = 0 self.notNull = False self.unique = False self.references = self.default = def

[Tutor] Database connections don't stay alive

2005-06-03 Thread Olli Rajala
Well, I asked about tutorials, but maybe this was not so good day, because it has been quite silent. :) So, good tutorials are still welcome, though I know now how to connect to the Postgresql database. I just have some problems, though. With MySQL I can do like this: import MySQLdb def

Re: [Tutor] Database connections don't stay alive

2005-06-03 Thread Kent Johnson
Olli Rajala wrote: Well, I asked about tutorials, but maybe this was not so good day, because it has been quite silent. :) So, good tutorials are still welcome, though I know now how to connect to the Postgresql database. I just have some problems, though. You might want to try asking on

[Tutor] insering into lists through slices

2005-06-03 Thread venkata subramanian
Hi, I am a newbie to Python (that's very guessable). I simply fail to understand the semantics of the following piece of code. #assuming ls=[1,2,3,4] ls[1:1]=[5,6] #then ls becomes ls [1, 5, 6, 2, 3, 4] i would be happy to know how it works. Basically, ls[1:1] returns an empty list

Re: [Tutor] insering into lists through slices

2005-06-03 Thread Pujo Aji
when you operate slice be carefull of the position of pointer which slice the list: L = [0 , 1 , 2 , 3] ^ ^ pos 0 1 That's why : L = [1,2,3] L[0:1] = [7] print L # will replace element 1 L = [1,2,3] L[1:1] = [7] print L # will insert 7 between element 1 and 2

[Tutor] Webbrowser module

2005-06-03 Thread mjp
I am using the webbrowser module to open a URL in Mozilla. My question is what happens when I exit from Mozilla. I have a script running on a Desktop with WindowsXP and a Laptop also with windowsXP In the first case return from Mozilla is to the function containing the webbrowser command ,in the

Re: [Tutor] interactif or not

2005-06-03 Thread Alan G
If I invoke it in a shell.. then it can be verbose If it is launched from a crontab.. then it is less verbose. You need to check who the process owner is. That can be done on *Nix by reading the USER environment variable. Cron jobs are usually run under the 'cron' user I believe. Hoever

Re: [Tutor] Building an SQL query

2005-06-03 Thread Gabriel Farrell
On Thu, Jun 02, 2005 at 10:41:20PM +0100, Alan G wrote: Why not convert the list to a tuple before applying str(): str(tuple(ids_to_process)) I'm just getting started with Python and PostgreSQL but I found that str(tuple(valueList)) wouldn't work for me because I had a few values with

Re: [Tutor] insering into lists through slices

2005-06-03 Thread Danny Yoo
(For the gory details on what is allowed on the right hand side of an ^ assignment, you can take a quick look at the Reference Manual: Hi Venkata, Gaaa, I don't know my left from my right. *grin* I meant to say left hand side, since

Re: [Tutor] Building an SQL query

2005-06-03 Thread Danny Yoo
On Fri, 3 Jun 2005, Gabriel Farrell wrote: def sqlNice(valueList): count = 1 y = '(' for x in valueList: x = x.replace(', '') y = y + ' + x + ' if count len(valueList): y = y + ', ' count = count + 1 y = y + ')' y =

[Tutor] python and apache....

2005-06-03 Thread Taylor, Chris
How do I execute a python script on my apache server? *(I am attempting to install googles sitemap generator thanks Chris STATEMENT OF CONFIDENTIALITY:The information contained in this electronic message is intended for the exclusive use of the addressee(s) and may contain

Re: [Tutor] question about hiding a function/method in a class

2005-06-03 Thread Mike Hansen
Subject: Re: [Tutor] question about hiding a function/method in a class From: Kent Johnson [EMAIL PROTECTED] Date: Fri, 03 Jun 2005 09:45:20 -0400 CC: tutor@python.org Mike Hansen wrote: class DBField(object): def __init__(self, fieldName): self.fieldName =

Re: [Tutor] Postgresql+Python -tutorial?

2005-06-03 Thread Alan G
I've been using MySQL up this day, but would like to convert my program to use Postgresql. I'm curious. Why? Is there some advantage to Postgres over MySql? The reason I ask is that I am torn between these two for my own use. Up until now I've been a happy user of Intebase on both Windows

Re: [Tutor] question about hiding a function/method in a class

2005-06-03 Thread Alan G
I haven't done much OO in Python yet. For various web apps we write, we usually write up a DB schema in a spreadsheet. Wow! How exactly do you represent a schema in a spreadsheet? I confess I cannot conceive of such a thing. Can you send a representative sample to illustrate? create the

Re: [Tutor] insering into lists through slices

2005-06-03 Thread Alan G
I simply fail to understand the semantics of the following piece of code. #assuming ls=[1,2,3,4] ls[1:1]=[5,6] #then ls becomes ls [1, 5, 6, 2, 3, 4] Basically, ls[1:1] returns an empty list and assigning [5,6] to it, actually inserts the elements... but how? ls[1:1] returns

Re: [Tutor] question about hiding a function/method in a class

2005-06-03 Thread Mike Hansen
Alan G wrote: I haven't done much OO in Python yet. For various web apps we write, we usually write up a DB schema in a spreadsheet. Wow! How exactly do you represent a schema in a spreadsheet? I confess I cannot conceive of such a thing. Can you send a representative sample to

Re: [Tutor] Postgresql+Python -tutorial?

2005-06-03 Thread Olli Rajala
I said: I've been using MySQL up this day, but would like to convert my program to use Postgresql. And then Alan G replied: I'm curious. Why? Is there some advantage to Postgres over MySql? Well, I'm not 100% sure. I've been using MySql some years now. It may sound that I know much, but

Re: [Tutor] Building an SQL query (Gabriel Farrell)

2005-06-03 Thread Lloyd Kvam
The code to update the database should look something like: the_cursor.execute( sql_cmd, data) I am not using postgresql so I do not know the place-holder mark for your module. You can get that from the module documentation. So sql_cmd could be something like UPDATE my_table SET

Re: [Tutor] python and apache....

2005-06-03 Thread Danny Yoo
On Fri, 3 Jun 2005, Taylor, Chris wrote: How do I execute a python script on my apache server? *(I am attempting to install google's sitemap generator... Hi Chris, This is more of an Apache configuration question, so you may get better help by asking on an Apache-specific forum. It's not

Re: [Tutor] Postgresql+Python -tutorial?

2005-06-03 Thread Danny Yoo
On Fri, 3 Jun 2005, Alan G wrote: I've been using MySQL up this day, but would like to convert my program to use Postgresql. I'm curious. Why? Is there some advantage to Postgres over MySql? Hi Alan, Yes. The 'MySQL Gotchas' page details specifically some of the tricky areas that are

Re: [Tutor] [Pythoncard-users] TextField bug?

2005-06-03 Thread Liam Clarke
What's tfStudy? I assume it's your textfield.What are the attributes of your text field in the resource file? If you copy and post your code and resource file somewhere like this - http://www.rafb.net/paste/ it'd be a lot easier to figure out. On 6/4/05, John Henry [EMAIL PROTECTED] wrote:

Re: [Tutor] question about hiding a function/method in a class

2005-06-03 Thread Alan G
Maybe it's not a schema exactly. |Table Name|Fields |Type |Size|Primary Key|Not Null|Unique|Foreign Key| ... |'s represent each cell. It's just a way to organize your thoughts, and have something a little more readable than an SQ script for a DB schema. There's been less than 20 tables

Re: [Tutor] Building an SQL query

2005-06-03 Thread Lee Harr
data = {} data['ids_to_process'] = ['1','2','3','5','7','11'] query = ''' UPDATE my_table SET state = 'processed' WHERE id IN ARRAY%(ids_to_process)s ''' db.execute(query, data) Sorry. It should look like ... query = ''' UPDATE my_table SET state = 'processed'

Re: [Tutor] Postgresql+Python -tutorial?

2005-06-03 Thread Lee Harr
I've been using MySQL up this day, but would like to convert my program to use Postgresql. I'm curious. Why? Is there some advantage to Postgres over MySql? Postgres behaves a lot like Python in that it'll die early rather than try to guess at what the user means. Postgres handles bad data

Re: [Tutor] Building an SQL query (Gabriel Farrell)

2005-06-03 Thread Gabriel Farrell
On Fri, Jun 03, 2005 at 03:50:09PM -0400, Lloyd Kvam wrote: The code to update the database should look something like: the_cursor.execute( sql_cmd, data) In PyGreSQL/pgdb it's cursor.execute(query[, params]) but it means more or less the same thing because pgdb's paramstyle (I knew from the

Re: [Tutor] interactif or not

2005-06-03 Thread ZIYAD A. M. AL-BATLY
On Fri, 2005-06-03 at 18:45 +0100, Alan G wrote: If I invoke it in a shell.. then it can be verbose If it is launched from a crontab.. then it is less verbose. You need to check who the process owner is. That can be done on *Nix by reading the USER environment variable. Cron jobs

[Tutor] Class reference problem?

2005-06-03 Thread [EMAIL PROTECTED]
for item in function1(args): object = class() if (function2(item)): if (condition): object.variable = value object.function() print object # debug print object #debug The above pseudo code (not really, but close enough) is essentially

Re: [Tutor] Class reference problem?

2005-06-03 Thread Danny Yoo
On Fri, 3 Jun 2005, [EMAIL PROTECTED] wrote: for item in function1(args): object = class() if (function2(item)): if (condition): object.variable = value object.function() print object # debug print object #debug The above

Re: [Tutor] Class reference problem?

2005-06-03 Thread Kent Johnson
[EMAIL PROTECTED] wrote: for item in function1(args): object = class() if (function2(item)): if (condition): object.variable = value object.function() print object # debug print object #debug The above pseudo code (not

Re: [Tutor] Class reference problem?

2005-06-03 Thread [EMAIL PROTECTED]
Hmmm... you may want to modify the print statements slightly to make it more clear which of the two print statements are being displayed. As the code stands, it's not clear that 'condition' is ever set to true. /me slaps himself in the forehead. After modifying the print statements as