@# Quotes DB     useful, funny, interesting





Google
 
Web www.quotesdb.info
Undernet  |  EFnet  |  Quakenet  |  Freenode  |  Dalnet  |  Ircnet  |  Galaxynet


Comments:

<0> huuu
<0> pythonists :)
<1> as opposed to the 2500 people who read it daily
<1> durr, mischan
<2> what would be the best way to write a tar script that only tars directories
<3> Hi
<3> Does anyone know a good tutorial for doing HTML screen scraping using Python?
<3> n/m
<3> found a nice tutorial
<4> hmm whats a cross-platform GUI toolkit that isnt ugly like most of them tend to be?
<5> lucifer: wxPython/Cocoa? ;)
<5> lucifer: But then, once you have it running with GTK on Linux, it doesn't look quite as good
<4> exactly :( and i heard wx isnt that stable :(



<4> people should just all buy macs
<5> wx isn't stable? that's news to me.
<4> dunno; maybe the guy who told me pulls too ugly **** in his code :P
<5> wxWindows is stable, and wxPython is more or less just a wrapper around that
<4> hmm i just tried wax.. a wrapper around wxpython.. and it crashed python itself..
<4> not that i liked wax so it didnt matter :P
<6> Hi all. Is there a good web primer for Python? I know a little Perl, C/C++, and shell scripting, but never looked into Python...
<7> Have you tried the tutorial?
<6> Mhm, "the tutorial"? :)
<6> (I would think that's a no :)
<7> http://docs.python.org/tut/tut.html
<6> Thanks :)
<7> You're welcome.
<6> Cool, that solved my problems. Thanks again :)
<8> hello
<8> what variables exactly are in the locals() dict and what in the globals()?
<9> can someone please tell me what the purpose is of the double underscore ?
<9> like __init__
<9> etc
<10> I am using mysqlDB and I am banging my head against the wall here
<10> can someone tell me what I am doing wrong
<10> cursor.execute ("""INSERT INTO ws (DriverID, fRaceID, lRaceID, Streak) VALUES ( %s , %s , %s , %s );""", (LastDid, fw, row[1]-1, scount) )
<10> it never inserts anything
<11> isn't one of the parameters you give, an int?
<11> decimal
<11> ..
<11> then u could try %d
<11> instead of the %s
<10> oh, oops
<10> they are all ints
<11> try %d then, instead of %s, might do the trick
<10> I like python, I just started programming in it last wednesday
<11> im not much longer... only not worked with mysqldb yet
<10> I haven't programmed in a year, and I have accomplished more in the past week than I ever have programming before
<11> what you trying to make then?
<10> I am making a database of F1 results
<10> ok I have this now , %i , %i , %i );""", (int(LastDid), int(fw), int(row[1]-1), int(scount))
<10> and it says it still requires an int for an argument
<12> you have 4 int's with 3 ***ignments (%i), unless you didn't paste it all
<10> I didn't paste it all I think
<10> let me check
<10> nope I have 4 %is
<12> let me ask you, does your cursor require a cursor.commit() ?
<12> you may not be commiting your changes
<10> i'm not sure
<12> ok, are you sure of the syntax?
<12> of cursor.execute()
<12> right now you have, cursor.execute("insert into...", (var1, var2, ...))
<12> Maybe try
<12> cursor.execute("insert into..." % (var1, var2, ...))



<10> I am so far as IF i type that same thing into the MYSQL command prompt it would work
<12> no, I mean the syntax of the cursor.execute() function
<12> you are using a comma to p*** the variables, ***uming that .execute() is expecting a tuple
<12> it may not be
<10> i'm trying some of the stuff you recomended, thankyou very much
<10> no ym cursor doesn't have a commit
<10> I could spit it out comma delimitted, but that is bastardized
<12> Threepwoo, you are using .execute() wrong
<12> do this instead
<12> cursor.execute ("""INSERT INTO ws (DriverID, fRaceID, lRaceID, Streak) VALUES ( %%s , %%s , %%s , %%s );""" % (LastDid, fw, row[1]-1, scount) )
<12> err, only %s obviously
<12> or replace with %i if you want
<12> but you see the difference?
<13> pjs: no.
<12> No?
<12> Does it take a tuple
<12> ?
<13> Propably implemention dependent.. but at least some do.
<13> psycopg2 accepts a dict
<12> right, but does MySQLdb?
<12> reading the doc right now, it doesnt appear to
<12> (I use pygresql myself)
<13> using cursor.execute("INSERT INTO xxx(x) VALUES(%(yeehaw)s)", dict(yeehaw="hey"))
<13> pjs: I tried pygresql for maybe 10 minutes and went with psycopg2 .. if you're not far into whatever project you're working on you might want to check it out :)
<13> it's *really* sweet
<12> heh, well. I already wrote my own cl*** to work pygresql, etc. A lot of code already depends on it :)
<13> :)
<12> Why didn't you like pygres?
<10> ok here is what I tried
<10> j= """INSERT INTO ...%i , %s , %s , %s )""" %(LastDid, f
<13> pjs: How do you insert a string that you don't know the contents of? (ie you don't know if it's an sql inject attempt)
<13> Threepwoo: that should work, except you need '%s' instead of just %s ..
<10> this spits out the exact command that I would type in mysql
<10> when I do cursor.execute(j)
<10> it still doesn't work
<13> Threepwoo: %s should be '%s'
<12> iGGy, Well most of the stuff is inputted by me. When a user is inputing something, I run checks against the data first..
<12> (not the most effecient im sure)
<10> when I try that, it prints this, , Streak) VALUES ( 679 , '668' , 669 , 2 )
<13> pjs: k. in psycopg2 you on't need to check nor escape it first.
<13> Threepwoo: You don't need to enclose numbers in '' (you can though), but strings needs to be enclosed.
<13> Threepwoo: what you write looks OK though
<10> ok, this is really wierd, I think it works
<12> iGGy, Ahh. Yea, that is one thing I need to change
<10> when I use the MySQL administrator tool, it shows table ws having 395 rows, but the command line client returns nothing
<10> on SELECT * FROM ws;
<10> one second, let me try something
<10> AHHHHHHHH I see
<10> its not cursor.commit() its db.commit()
<10> sorry guys,
<12> heh
<14> hello, i am going through the tutorial on python.org. why is 7/-3 -3 shouldn't it be -2?
<10> thanks so much guys
<10> this is when programming gets frustrating, when I am 99% there and I am held up by a small syntatical error
<10> have you tried using parentheses
<14> are you talking to me threepwoo?
<14> i do't see why parenthese would matter
<14> and they dont


Name:

Comments:

Please enter the result of the sum 63 + 46 (to avoid spam):






Return to #python
or
Go to some related logs:

#microsoft
#windows
#unix
#computers
#gamedev
#netbsd
#beginner
murex's version
#beginner
#nhl



Home  |  disclaimer  |  contact  |  submit quotes