Re: [Tutor] forum

2006-08-05 Thread Brian Gustin
Signed up, but it never send me the confirmation email (yes, I used a valid email address) . It's been 2 hours, and still no email. How the HECK does one contact the forum admin to ask them to activate my account? I signed up with [EMAIL PROTECTED] Grrr.. I really hate forums that have admins

Re: [Tutor] I Give Up. - Follow up post

2006-07-05 Thread Brian Gustin
> > The other alternative is to provide a tool for editing the file in which > case the format is less important sionce hiumans "never" need to > touch it. > Heh. good analysis.. now I feel a little dumb- I should have thought of this *LONG* ago. yeah I knew about the xml parser , and how to do

Re: [Tutor] I Give Up. - Follow up post

2006-07-04 Thread Brian Gustin
OK .. so far so good.. :) > ultimately want is not meshing well together. > > Let's clarify the requirement: you want to have a mapping from services > to their configurations. Ignoring the format of the configuration file > for the moment, it sounds like you ultimately want to parse the > con

Re: [Tutor] I Give Up. - Follow up post

2006-07-04 Thread Brian Gustin
Danny Yoo wrote: >> I tried it by opening a file , but could find no way to do variable >> variables > > > > Hi Brian, > > Look for the concept of dictionaries in Python. "Variable variables" in > languages like PHP and Perl are doable in Python, but a dictionary > usually handles such si

Re: [Tutor] I Give Up. - Follow up post

2006-07-04 Thread Brian Gustin
OK see, what I was doing originally (and I found time to finally get it partially working) I have a configuration file that may be edited by webmaster thus [Ports] http = 80 https = 443 http1 = 81 smtp = 25 smtp2 = 587 (the above is a small example, it could be *anything* ) Now I have a funct

Re: [Tutor] I Give Up.

2006-06-17 Thread Brian Gustin
Thanks- I had to sit back and with the perl script running nicely, I took another shot at this to see if I could get it right.. so far so good, at least no more exceptions being raised.. The perl script runs on a cron, I am thinking I will write this in python and then wrap it up into a main f

[Tutor] I Give Up.

2006-06-17 Thread Brian Gustin
I have had it. I give up. Python's documentation sucks beyond belief. all I want to do is parse a *SIMPLE* config file of name = value pairs and have python objects named by the name holding the value signified by value , and I want it to be able to work *WITHOUT* someone having to download an

Re: [Tutor] Didn't take long to hit my next wall!

2006-04-16 Thread Brian Gustin
cursor.execute(sql_string,%(tuplea,tupleb)), etc. thanks for the heads up. Bri! Kent Johnson wrote: > Brian Gustin wrote: > >>python in this form uses BIND variables.. >> >>query = '''UPDATE cost_grid >> >> SET cost_1 = %s <-

Re: [Tutor] Didn't take long to hit my next wall!

2006-04-16 Thread Brian Gustin
python in this form uses BIND variables.. >>query = '''UPDATE cost_grid >> SET cost_1 = %s <--- %s = the bind variable placeholder/formatter >> WHERE cost_grid_id = %s >> AND finish_dro = %s % ( a,c,b) <--- the raw tuple That is, what is provi

Re: [Tutor] School Boy Error

2006-04-16 Thread Brian Gustin
I wonder if it could not be the extra comma (,) at the end of your sql ? thus: ..?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,)<--- see trailing comma, and no matching ? could be a value count != column count mis-match make sure you have the correct number of values to each column :) On the oth

Re: [Tutor] School Boy error

2006-04-16 Thread Brian Gustin
instead of c.execute(stat, listy[-1]) try sql_list = listy[-1] c.execute(stat, sql_list) Also what does print stat give you? maybe one of those two would tell us .. Bri! John CORRY wrote: > Hi, > > > > I couldn’t sleep last night with all the code running though my head. > Counting sheep d

Re: [Tutor] School Boy Error

2006-04-15 Thread Brian Gustin
would be helpful to paste the entire error information that python gives .. including the lines before and after. When pytho sets an error , it will tell you *exactly* where the error is at (or it should) I do all my development work on Linux, havent worked with ODBC databases, but the reference

Re: [Tutor] What's the invalid syntax?

2006-04-05 Thread Brian Gustin
define year first I.E. year=0 int(year) or leave the int year out of your code completely - you do not need to typecast - it is set as an integer in the following line. Nathan Pinno wrote: > Hey all, > > What's the invalid syntax in the following code? I tried figuring it out > by myself, a

Re: [Tutor] date conversion

2006-04-05 Thread Brian Gustin
Oh yeah - you can also simply use Mysql's date_format() function when you query the database ?? select date_format(column_name,'%d-%b-%Y') as formatted_date from table where blah; would output the date as 05-Apr-2006 http://dev.mysql.com/doc/refman/4.1/en/date-and-time-functions

Re: [Tutor] date conversion

2006-04-05 Thread Brian Gustin
I wrote something similar on my blog some time back.. http://phplogix.com/codefool/?postid=13 This is for converting Apache logfiles to a ISO formatted date for mysql.. It could easily be reversed, with a little tweaking.. :) to wit: def mreplace(s, chararray, newchararray): for a, b in zip

Re: [Tutor] Opening .py files in firefox

2006-03-19 Thread Brian Gustin
server needs to be set up with a handler to tell it what to do with the file , otherwise it will look at local host to determine what to do with it , via the extension, and if no extension is found, then it will simply offer to download the file to your computer . if you want it to display as t

Re: [Tutor] Mysql BLOB strangeness?

2006-03-19 Thread Brian Gustin
that returns the result set, instead, and then iterate over that list object.. Bri! Adam Cripps wrote: > On 3/18/06, Brian Gustin <[EMAIL PROTECTED]> wrote: > >>Oh. just found the original question.. :) >> >>OK perhaps this would be more helpful if you were to manually

Re: [Tutor] Mysql BLOB strangeness?

2006-03-18 Thread Brian Gustin
Oh. just found the original question.. :) OK perhaps this would be more helpful if you were to manually query mysql on command line and paste the results it outputs here. what I am betting is your method to get the data out of teh query is doing exactly what you tell it to.. :) but this hinges

Re: [Tutor] Mysql BLOB strangeness?

2006-03-18 Thread Brian Gustin
e piece of data from mysql as a single object, and assign it a reference... but that depends heavily on how you structure your query and has more to do with mysql than with python itself :) Bri! Adam Cripps wrote: > On 3/17/06, Brian Gustin <[EMAIL PROTECTED]> wrote: > >>

Re: [Tutor] Mysql BLOB strangeness?

2006-03-17 Thread Brian Gustin
if the data is not binary, you can use TEXT type - accepts all readable characters and data, BLOB type is more for binary data storage, and MYSQL's Varchar type only stores up to 255 characters. (65,536 bits, or 64Kbits) If you are storing Binary data (DES-3 encrypted data, or image data, for

Re: [Tutor] Repeating a routine

2006-02-22 Thread Brian Gustin
yeah GOTO , in basic (I used to write software in Commodore BASIC myself) is similar to a for or while loop - In BASIC, you would write a program, *including* line numbers thus: 10 a=32 20 b="hello" 30 print a 40 print b 50 a=a-1 60 if a > 0 goto 20 70 end (It's probably not 100% syntactically

[Tutor] File handling: open a file at specified byte?

2006-02-19 Thread Brian Gustin
HI. This is one I cant seem to find a solid answer on: First, some background: I have a log file that I wrote a python parser for it, and it works great , but in the interest of saving time and memory , and also to be able to read the currently active log file, say every 10 minutes , and update

Re: [Tutor] MySQLdb: at a complete loss

2006-02-18 Thread Brian Gustin
Servando Garcia wrote: > Hello List > I am at a complete loss. Here is a recap, just to be clear, I have > been unable insert into a database using MySQLdb. I can only view the > database. > My current configuration: > 1. Windows XP > 2. Python 2.4.2 > 3 MySQLdb current version