how to store and still search special characters in Python and MySql

2007-02-11 Thread ronrsr
I have an MySQL database called zingers. The structure is: zid - integer, key, autoincrement keyword - varchar citation - text quotation - text I am having trouble storing text, as typed in latter two fields. Special characters and punctuation all seem not to be stored and retrieved correctly.

Special Characters (Unicode, Ascii) in Python and MySQL

2007-01-01 Thread ronrsr
I have an MySQL database called zingers. The structure is: zid - integer, key, autoincrement keyword - varchar citation - text quotation - text I am having trouble storing text, as typed in latter two fields. Special characters and punctuation all seem not to be stored and retrieved correctly.

dealing with special characters in Python and MySQL

2006-12-17 Thread ronrsr
I have an MySQL database called zingers. The structure is: zid - integer, key, autoincrement keyword - varchar citation - text quotation - text the encoding and collation is utf-8 I am having trouble storing text, as typed in last two fields. Special characters and punctuation

Re: dealing with special characters in Python and MySQL

2006-12-17 Thread ronrsr
structure for the DB: CREATE TABLE `zingers` ( `zid` int(9) unsigned NOT NULL auto_increment, `keywords` varchar(255) default NULL, `citation` text, `quotation` text, PRIMARY KEY (`zid`) ) ENGINE=MyISAM DEFAULT CHARSET=UTF8 AUTO_INCREMENT=422 ; code for

Re: dealing with special characters in Python and MySQL

2006-12-17 Thread ronrsr
are you passing in the strings as Unicode strings, or as something else? if you're using something else, what have you done to tell the database what it is? not at all sure what I'm passing it as. The database default encoding is utf-8 the database collation is utf-8 the page encoding

Re: dealing with special characters in Python and MySQL

2006-12-17 Thread ronrsr
version of python is 2.2 - -- http://mail.python.org/mailman/listinfo/python-list

Re: dealing with special characters in Python and MySQL

2006-12-17 Thread ronrsr
version of python is either 2.2 or 2.4 bests, -rsr- John Nagle wrote: ronrsr wrote: -- http://mail.python.org/mailman/listinfo/python-list

Re: dealing with special characters in Python and MySQL

2006-12-17 Thread ronrsr
Try putting use_unicode=True in the MySQLdb connect call. tried that, and also added charset=utf8 - now, I can't do any string operations, I get the error msg: descriptor 'lower' requires a 'str' object but received a 'unicode' args = (descriptor 'lower' requires a 'str' object

can't get cgi values

2006-11-27 Thread ronrsr
I'm having trouble extracting cgi parameters in my code - this is a web application, so I only know the line that's causing the problem. here's the info I know: form = FieldStorage(None, None, [MiniFieldStorage('zid', '17'), MiniFieldStorage('keywords', 'aAUA'), MiniFieldStorage('keywords',

Re: can't get cgi values

2006-11-27 Thread ronrsr
Thank you, all. that was very helpful, and did solve many of my problems. I was addressing the dict with () rather than []. I'm still having one problem, though -- extracting the keywords. NOw, if you check the value for Form below, you'll see there is more than one keyword entry. When I do:

Re: can't get cgi values

2006-11-27 Thread ronrsr
Thank you, all. that was very helpful, and did solve many of my problems. I was addressing the dict with () rather than []. I'm still having one problem, though -- extracting the keywords. NOw, if you check the value for Form below, you'll see there is more than one keyword entry. When I do:

splitting a long string into a list

2006-11-27 Thread ronrsr
I have a single long string - I'd like to split it into a list of unique keywords. Sadly, the database wasn't designed to do this, so I must do this in Python - I'm having some trouble using the .split() function, it doesn't seem to do what I want it to - any ideas? thanks very much for your

splitting a long string into a list

2006-11-27 Thread ronrsr
I have a single long string - I'd like to split it into a list of unique keywords. Sadly, the database wasn't designed to do this, so I must do this in Python - I'm having some trouble using the .split() function, it doesn't seem to do what I want it to - any ideas? thanks very much for your

Re: splitting a long string into a list

2006-11-27 Thread ronrsr
that - I thought split wuld do that, but it doens't. bests, -rsr- Robert Kern wrote: ronrsr wrote: I have a single long string - I'd like to split it into a list of unique keywords. Sadly, the database wasn't designed to do this, so I must do this in Python - I'm having some trouble using

Why isn't SPLIT splitting my strings

2006-11-19 Thread ronrsr
I'm trying to break up the result tuple into keyword phrases. The keyword phrases are separated by a ; -- the split function is not working the way I believe it should be. Can anyone see what Im doing wrong? bests, -rsr- print newstring =, str(result[i][0]) print just split,

determining the bounds of a tuple returned from a database

2006-11-16 Thread ronrsr
here is my result. How do I determine the number of tuples in this array, returned from a mysql database? How do I determine the number of characters or entry in each tuple? thanks very much for your assistance, -rsr- (('Agricultural subsidies; Foreign aid',), ('Agriculture; Sustainable

Re: determining the bounds of a tuple returned from a database

2006-11-16 Thread ronrsr
it looks like the len() function is the one I want. for: len(result) - i get 248, but for len(result[0]) or len(result[1]) i always get 0. ronrsr wrote: here is my result. How do I determine the number of tuples in this array, returned from a mysql database? How do I determine

Re: determining the bounds of a tuple returned from a database

2006-11-16 Thread ronrsr
how many strings, or how many bytes are in each dimension? so that I can iterate through them. Each entry in that list is a keyword - Alternately, is there any fast way to parse that into a sorted list of distinct keywords. very sorry for the error. bests, -rsr- Fredrik Lundh wrote: ronrsr

Printing database output in tabular form

2006-11-13 Thread ronrsr
when I try to print a web table containing output from a database, I am getting more info than I want- - I would like this to print w'o the array('c',AND I'd like the control characters to print as HTML control chars. array('c', '- In the boom years of 1990-1997 developing countries paid

Re: Printing database output in tabular form

2006-11-13 Thread ronrsr
On Nov 13, 2:48 pm, Fredrik Lundh [EMAIL PROTECTED] wrote: ronrsr wrote: when I try to print a web table containing output from a database, I am getting more info than I want- - I would like this to print w'o the array('c',arrays instead of strings? what database is this, and how

Re: Printing database output in tabular form

2006-11-13 Thread ronrsr
I just changed the database to be a TEXT field, and that took care of the array() stuff - Now, I'm trying to convert the formatting codes to html. thanks for your help. bests, r0sr- -- http://mail.python.org/mailman/listinfo/python-list

format requires a mapping?

2006-11-12 Thread ronrsr
what is python trying to tell me here? does it have to do with formatting the string. Keywords and Zinger are fields in my database. print tr td class=padplace width=120Keywords/td td class=padplace idth=660Zinger/tdtd TypeError: format requires a mapping thanks much in

how do i map this?

2006-11-12 Thread ronrsr
I think I am passing the wrong argument to the Print_row routine: Traceback (most recent call last): File index.py, line 91, in ? zhtml.print_row(record) File /usr/www/users/homebase/realprogress/zingers/zhtml.py, line 154, in pri nt_row print tr TypeError: format requires a mapping

SyntaxError: Invalid Syntax.

2006-11-10 Thread ronrsr
no matter where I place this imported file,the statement after it in the main program gets a syntax error, regardless of the syntax. I think I may have changed something in this file, but I'm stuck. Can anyone help? #!/usr/local/bin/python # Copyright 2004 by Stephen Masterman #Change the db

Re: SyntaxError: Invalid Syntax.

2006-11-10 Thread ronrsr
here's some of the surrounding code from the main program: querystring = querystring + ORDER BY keywords ; #SQL import zsql zc = zsql.connect() print(return from open) zq = zc.query(querystring).dictresult() ronrsr wrote: no matter where I place this imported file,the statement

Re: SyntaxError: Invalid Syntax.

2006-11-10 Thread ronrsr
that, I still get the same error. bests, -rsr- ronrsr wrote: here's some of t -- http://mail.python.org/mailman/listinfo/python-list

Re: SyntaxError: Invalid Syntax.

2006-11-10 Thread ronrsr
the exact code that is triggering the error message is: zc = zsql.connect() exact error message: SyntaxError: Invalid Syntax but any statement that follows the import statement will trigger it. bests, r-sr- Roberto Bonvallet wrote: ronrsr wrote: thanks for the speedy answer. what

Re: SyntaxError: Invalid Syntax.

2006-11-10 Thread ronrsr
the syntax error comes in the main program, in any line that follows the import statement. ronrsr wrote: the exact code that is triggering the error message is: zc = zsql.connect() exact error message: SyntaxError: Invalid Syntax but any statement that follows the import statement