#apache #archlinux #asterisk #centos #debian #gentoo #haskell #kde #kubuntu #lisp #math #mysql #perl #python #ruby-lang #rubyonrails #suse #ubuntu #vim #wikipedia 0 1 2 3 4 5 6 7 8 9 10 
Top Prev 6674 6675 6676 6677 6678 6679 6680 6681 6682 6683 6684 6685 6686 6687 6688 6689 6690 6691 6692 Next

#python

<Necroalbert> Parser is the name of my file
<alakdan> Otacon22: int('num',10) ?
<Otacon22> oh
<Otacon22> ..
<Necroalbert> And i try to write value in the DB
<whaley> Necroalbert: fwiw, the values that are failing have a comma in them... parser.py isn't doing any splitting on commas is it?
<Necroalbert> At the top you can see the request ( print in the console ) when i execute this command with mysql command it's work ...
<Necroalbert> Tou think it's a coma problem ?
<whaley> Necroalbert: post the source of Parser.py
<Necroalbert> Ok
<whaley> Necroalbert: if you are splitting that sql statement by commas to separate tempid,x,y,z then yes that is the problem... because it's also splitting up -4039,4 into different indexes
<Necroalbert> http://pastebin.ca/370313
<Necroalbert> My value in the text file are separate by space
<Necroalbert> I split this
<Necroalbert> TYPEID_UNIT: -4039,4 -13773,65 75,30835 5,183628
<Necroalbert> If someone have an idea why it doesn't work ^^
<whaley> Necroalbert: the problem is with your calling the split method directory instead of as an instance method of string
<whaley> split(DATA_TYPE[1]) is returning the full string
<whaley> and split(DATA_TYPE[1])[0] is just returning the first character of that string
<Necroalbert> No
<Necroalbert> Because
<Necroalbert> split(DATA_TYPE[1])
<Necroalbert> return a tuple
<Necroalbert> ['-4039,4','-13773,65','75,30835','5,183628']
<Necroalbert> And split(DATA_TYPE[1])[0] return '-4039,4'
<whaley> Necroalbert: go into the interpreter and run from string import split; split("helloworld")
<whaley> you have to tell split what to delimit by
<Necroalbert> If split have no argument
<whaley> otherwise you get a list of of 1 element, which is the string you passed in
<Necroalbert> It split the space
<whaley> erm, yeah, you're right, my fault
<Necroalbert> no problem
<Necroalbert> But i Don't know why
<Necroalbert> my print request work
<Necroalbert> but not my send request :(
<T`> if i had two date() objects.. how can i get the diffference in years?
<T`> doing a diff.days/365 seems not right
<T`> due to leap years, etc..
<T`> i basically want to check if a user input date is 18 years old or not..
<T`> so doing inputdate - date.today() to get the diff.. not sure how to get that in years though..
<whaley> Necroalbert: try creating the string first, separate the interplation from the cur.execute method and print out to debug... there's gotta be something simple going on
<timonator> i suggest opening up a python console and trying all the stuff that comes to your mind
<whaley> *interpolation
<Necroalbert> whaley > Yep i will try thanks ;)
<timonator> including running help and dir on all involved objects
<moldy> hi
<whaley> wish I could help more... my python is rusty :)
<whaley> stuck in java land lately
<Necroalbert> :D
<Necroalbert> My python is bad too

Previous Page  Next Page

Search ircarchive.info