Re: [Tutor] Searching for email id in MySQL giving wrong results

2006-01-23 Thread ZIYAD A. M. AL-BATLY
On Mon, 2006-01-23 at 14:00 -0500, Python wrote: > The wrong_string line was lifted from the following code in the OP. > > entry = db.cursor() > entry.execute("""SELECT * FROM contact WHERE email_id = %s""", > (s_email,)) > > The execute method will handle the string substitution

Re: [Tutor] Searching for email id in MySQL giving wrong results

2006-01-22 Thread ZIYAD A. M. AL-BATLY
On Sun, 2006-01-22 at 12:43 +, John Joseph wrote: > Hi Hi John... Most of your problems in your code seems to be caused by a single mistake. Compare the following two strings and you should figure out what's wrong by yourself: email_id = '[EMAIL PROTECTED]' wrong_s

Re: [Tutor] PAMIE but for linux

2006-01-15 Thread ZIYAD A. M. AL-BATLY
On Sun, 2006-01-15 at 00:44 -0200, Ismael Garrido wrote: > Hi > > Is there anything like PAMIE but for a linux browser? Even better if it > works in windows and linux. PAMIE lets you control Internet Explorer > programmatically. > > I've read about PyXPCOM (for mozilla) but I coudn't find any d

Re: [Tutor] Random in loop

2006-01-14 Thread ZIYAD A. M. AL-BATLY
On Sat, 2006-01-14 at 17:52 -0800, ryan luna wrote: > Hello, Im kinda stuck on something in the book Python > Programming. > The "Challenage" is to make a progam that flips a coin > 100 times and then tells you the number of heads and > tails. > here is what i have so far, > Code: > > import rando

Re: [Tutor] Any good Glade and python tutorials?

2005-10-15 Thread ZIYAD A. M. AL-BATLY
On Sat, 2005-10-15 at 20:13 +0100, Adam wrote: > I'm making a Twisted app that needs a client side GUI and GTK seems > like the best way to go about this. Can anybody point me in the > direction of any decent tutorials on how to use Glade with python and > pyGTK. > Thanks. > Adam. http://primates.

Re: [Tutor] and-or precedence

2005-10-10 Thread ZIYAD A. M. AL-BATLY
On Mon, 2005-10-10 at 17:58 +0530, Krishna wrote: > >>> 1 or 2 and 3 > 1 > > Why does the above expression return 1? As per my understanding of > boolean operations, this is what should have happaned: > > 1 or 2 => 1 and then > 1 and 3 => 3 > > The library reference also suggests that 'or' has h

Re: [Tutor] encode question!

2005-09-27 Thread ZIYAD A. M. AL-BATLY
On Tue, 2005-09-27 at 14:01 +0800, 铁石 wrote: > I am trying to write a stript that extract jpg files > from a html I had downloaded.I encounter a problem with > a Big5 charset html file.Big5 used in Hongkong ans Taiwan. > In this html file there's a jpg names "xvg_h%202.jpg" > in vi ,the

Re: [Tutor] Exception handling - syntaxerror?!

2005-09-25 Thread ZIYAD A. M. AL-BATLY
On Sun, 2005-09-25 at 19:44 +0530, Krishna wrote: > Think the mail system screwed up the formatting! But am fairly sure > that I have indented it correctly in the console. Try and Except are > in the column. Any other hints? Make sure you're not mixing "tabs" and "spaces". A lot of editors uses

Re: [Tutor] Exception handling - syntaxerror?!

2005-09-25 Thread ZIYAD A. M. AL-BATLY
On Sun, 2005-09-25 at 18:55 +0530, Krishna wrote: > When I try to run the following piece of code, I get a SyntaxError, > can someone help me out on this? > > try: > ... os.system("cls") > ... except: > ... print "Foo" > ... print "Bar" > Traceback ( File "", line 5 > print "Bar" >

Re: [Tutor] numbers from a name

2005-09-25 Thread ZIYAD A. M. AL-BATLY
On Sun, 2005-09-25 at 01:06 -0400, [EMAIL PROTECTED] wrote: > How could I change the program to accept something like: John Bob > Zelle Python or Kip Rada? > If it works for you with one word, all you need to make it accepts more is to add the space character " " with a weight of zero to "table".

Re: [Tutor] numbers from a name

2005-09-24 Thread ZIYAD A. M. AL-BATLY
On Sat, 2005-09-24 at 23:50 -0400, [EMAIL PROTECTED] wrote: > Hello Hi Goofball... > > with the following program I would like it to be able to take a > person's name and then assign values to each letter and come up with > a sum of all the letters in the name. for example if I entered bob. i > w

Re: [Tutor] Will someone please tell me how to read this?

2005-08-22 Thread ZIYAD A. M. AL-BATLY
On Mon, 2005-08-22 at 13:18 -0500, Lane, Frank L wrote: > Hi List, > > > > I cut and pasted a dump from recvfrom below. I can’t read it and > don’t where to look in the documentation to figure out how to read > this. > > > > Is there a name for this type of number? I’m assuming the \x mea

Re: [Tutor] reading excel and access files

2005-08-22 Thread ZIYAD A. M. AL-BATLY
On Mon, 2005-08-22 at 18:57 +0100, Alan G wrote: > > hello, can python read excel and access files? > > Yes > > > If so where do I go to read about how this would work? thanks. > > You need to use COM to do it, Mark Hammonds book "Python Programming > on Win32" gives several examples. But basica

Re: [Tutor] Linux app question

2005-08-18 Thread ZIYAD A. M. AL-BATLY
On Thu, 2005-08-18 at 18:10 +0100, Alan G wrote: > It might be /usr/bin/env... It is "/usr/bin/env". You could use "/usr/bin/python" instead under Linux (it might not work under other Unix like OSes). > Yes, in fact you dont really need to rename the file, its just a > nicety. > > All Unix scr

Re: [Tutor] LiveWires problems

2005-08-15 Thread ZIYAD A. M. AL-BATLY
On Mon, 2005-08-15 at 11:52 -0400, Michael Murphy wrote: > Hi all > > I'm having problems with installing LiveWire for python for Linux > (Linspire 5.0 to be exact) and I'm having trouble compiling setup.py. > Heres the results: > > running install > running build > running build_py > running ins

Re: [Tutor] Corrupt files (fwd)

2005-08-02 Thread ZIYAD A. M. AL-BATLY
On Tue, 2005-08-02 at 13:22 -0700, Danny Yoo wrote: > > -- Forwarded message -- > Date: Tue, 2 Aug 2005 22:12:34 +0200 (CEST) > From: "[iso-8859-1] yvind" <[EMAIL PROTECTED]> > To: Danny Yoo <[EMAIL PROTECTED]> > Subject: Re: [Tutor] Corrupt files > > Hello and thank you. > > I d

Re: [Tutor] question on string

2005-08-01 Thread ZIYAD A. M. AL-BATLY
On Mon, 2005-08-01 at 10:42 -0700, Gilbert Tsang wrote: > Hi there, > > I would like to construct some string objects using the cprintf-style > format: > > command_string = "diff -u %s %s > %s.patch" % ( src, dst, file ) > > Of course it is illegal in python but I couldn't figure out a way to

Re: [Tutor] range()-like function to generate aa, ... az, ..., zz ?

2005-07-28 Thread ZIYAD A. M. AL-BATLY
On Thu, 2005-07-28 at 13:59 -0400, Chris Shenton wrote: > I'm looking for a range()-like function which could generate a list of > character-oriented tokens, like to iterate over all two-character > sequences like: > > pseudorange('aa', 'zz') would generate: > aa, ab, ..., az, ba, ..., za, ...,

Re: [Tutor] OT python Licences

2005-07-13 Thread ZIYAD A. M. AL-BATLY
Hi everyone... On Tue, 2005-07-12 at 22:08 +0530, Sandip Bhattacharya wrote: > 2. Gtk. Simple API. A great RAD GUI builder (Glade). Cons are that you > have to have Pygtk installed on windows for your apps to run (I am not > sure if py2exe will package them for you as a standalone). Another co

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

2005-07-09 Thread ZIYAD A. M. AL-BATLY
On Sat, 2005-07-09 at 14:00 -0600, Nathan Pinno wrote: > What's the invalid syntax? > > Here's the code (Part of my Guess the Numbers game): > > if a0 == x0 and a1 == x1 and a2 == x2 and a3 == x3: > print "Congratulations! Way to go?" > answer = raw input("Play a

Re: [Tutor] Why is this error showing up? (Original Message: (Tutor) What's wrong with this code?) Ignore previous post.

2005-07-07 Thread ZIYAD A. M. AL-BATLY
On Thu, 2005-07-07 at 00:54 -0600, Nathan Pinno wrote: > Hi all, > > Here's one of the messages that pops up: > > Traceback (most recent call last): > File "D:\password.py", line 77, in ? > filename == raw_input("Filename to load: ") > NameError: name 'filename' is not defined > > Why i

Re: [Tutor] A newbie question about running python scripts

2005-06-16 Thread ZIYAD A. M. AL-BATLY
On Thu, 2005-06-16 at 08:08 -0700, typetext wrote: > I get exactly the same error message as below. What could be going on > here? To check that I am not misspelling the name, I also wrote a > script that says print "helloworld" and saved it as hello.py. The same > message comes up then, as well. A

Re: [Tutor] A newbie question about running python scripts

2005-06-16 Thread ZIYAD A. M. AL-BATLY
On Thu, 2005-06-16 at 07:23 -0700, typetext wrote: > Thank you for responding. Here is what happens when I type python > helloworld.py without any quotation marks into the command line:1. > The prompt line reads > 1.C:\Documents and Settings\Micky > 2. I type "python" > 3. the python prompt comes

Re: [Tutor] A newbie question about running python scripts

2005-06-15 Thread ZIYAD A. M. AL-BATLY
On Wed, 2005-06-15 at 20:19 -0700, typetext wrote: > I am trying to run my first python scripts from a windows XP command > line, and using Ivan Langhan's book Teach yourself python in 24 hours. > I have installed Active Python 2.4 and have had no trouble running the > scripts in the IDE . Followi

Re: [Tutor] A newbie question about running python scripts

2005-06-15 Thread ZIYAD A. M. AL-BATLY
On Wed, 2005-06-15 at 21:23 -0600, Chuck Allison wrote: > Dear Tutors, > > Here is a query from a student from a corporate class I'm teaching. Do > you know of any such modules of the top of your head? Thanks! > > === > Quick question since the next class isn't until Monday. Do you know of > a

Re: [Tutor] Can't figure out syntax error

2005-06-09 Thread ZIYAD A. M. AL-BATLY
On Thu, 2005-06-09 at 18:16 -0600, [EMAIL PROTECTED] wrote: > Hi there, > > I'm in the process of learning Python, and need some help deciphering > the reason why the following code doesn't work: > int(num) = int(num) / 2 # this is integer division, so we truncate the > decimal part Here's

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. Cr

Re: [Tutor] Covert numbers to hex fails

2005-05-24 Thread ZIYAD A. M. AL-BATLY
On Tue, 2005-05-24 at 22:56 -0400, Tom Tucker wrote: > Good evening! I am trying to pass a number variable and have it > converted to hex. Any recommendations on how to achieve this? Thank > you. > > FAILS > -- > >>> value = 1234567890 > >>> hexoutput = hex('%d' % (value)) > Traceback (

Re: [Tutor] *nix-specific Python Scripting [Off Topic]

2005-05-12 Thread ZIYAD A. M. AL-BATLY
On Thu, 2005-05-12 at 13:37 -0400, William O'Higgins wrote: > I am trying to learn Python by translating some of my Perl scripts. One > thing that is eluding me is assigning the results of system calls to > variables. Here's what I want to do in Perl: > > $isxrunning = `ps -C startx | gr

Re: [Tutor] scoping oddity

2005-05-07 Thread ZIYAD A. M. AL-BATLY
On Sat, 2005-05-07 at 12:56 -0400, Michael wrote: > Tanja, Bob, Brian, > > Many thanks for your help. > > And perhaps the way in which I posed the question was misleading. In a > process I am writing, I was actually trying not to use global variables, as > I agree with Brian. However, I inadv